问题描述
我正在尝试在我的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 () {
获得一些帮助来解决此问题非常好。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)