Javascript Flux(React)-使用(Container.creare())将类组件连接到视图时出错
我正在尝试在react项目中使用Flux,使用“Container.createFunctional()”将无状态函数连接到视图中效果良好,但使用“Container.create()”连接类组件时出错 我的代码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) {
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 () {