Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Flux(React)-使用(Container.creare())将类组件连接到视图时出错_Javascript_Reactjs_Flux_Reactjs Flux - Fatal编程技术网

Javascript Flux(React)-使用(Container.creare())将类组件连接到视图时出错

Javascript Flux(React)-使用(Container.creare())将类组件连接到视图时出错,javascript,reactjs,flux,reactjs-flux,Javascript,Reactjs,Flux,Reactjs Flux,我正在尝试在react项目中使用Flux,使用“Container.createFunctional()”将无状态函数连接到视图中效果良好,但使用“Container.create()”连接类组件时出错 我的代码 class HomeViewContainer extends Component { static getStores() { return [ContactsStore]; } static calculateState(prevState, props) {

我正在尝试在react项目中使用Flux,使用“Container.createFunctional()”将无状态函数连接到视图中效果良好,但使用“Container.create()”连接类组件时出错

我的代码

class HomeViewContainer extends Component {
  static getStores() {
    return [ContactsStore];
  }
  static calculateState(prevState, props) {
    const state = {
      //states
      counter: ContactsStore.getState(),
      //actions
      increment: ContactActions.increment,
    };
  }
  render() {
    return <HomeView {...this.state}></HomeView>;
  }
}
export default Container.create(HomeViewContainer);
如果能得到一些帮助来解决这个问题,那就太好了

TypeError: Class constructor HomeViewContainer cannot be invoked without 'new'
PureComponent.ContainerClass
node_modules/flux/lib/FluxContainer.js:129
  126 | 
  127 | _classCallCheck(this, ContainerClass);
  128 | 
> 129 | _Base.call(this, props, context);
      | ^  130 | this._fluxContainerSubscriptions = new FluxContainerSubscriptions();
  131 | this._fluxContainerSubscriptions.setStores(getStores(props));
  132 | this._fluxContainerSubscriptions.addListener(function () {