0
我在构造函数this.state = {};
中设置了状态,但是参数在calculateState
方法中为空。我应该在哪里设置容器的初始状态?为什么在Flux的calculateState方法中prevState参数为null?
class QuestionnairesContainer extends Component {
static getStores() {
return [QuestionnairesStore];
}
static calculateState(prevState) {
return {
questionnairesList: QuestionnairesStore.getState().questionnairesList,
pagingObject: prevState.pagingObject
};
}
constructor(props) {
super(props);
this.state = {
pagingObject: someData
};
}
render() {
return (
<section>
</section>
);
}
}
export default Container.create(QuestionnairesContainer);