可以将CombineReducer嵌套,还是应该使用一次将所有的reducer合并为一个?
通过在每个步骤上组合化简器来创建存储树结构的方法不好吗?
或者,也许还有其他方法可以保持根存储的整洁(以免将所有树叶都放在根存储中)
伪代码结构示例:
rootReducer = combineReducers({
router, // redux-react-router reducer
account: combineReducers({
profile: combineReducers({
info, // reducer function
credentials // reducer function
}),
billing // reducer function
}),
// ... other combineReducers
})
});
当然,这是个好主意。
您好,我在Multiple CombineReducer中实现了,
// schoolReducer.js
export default combineReducers({
company: companyReducer,
profile: profileReducer,
});
// studentInfo.js
export default combineReducers({
student: studentReducer,
course: courseReducer,
});
//rootReducer.js
export default combineReducers({
school: schoolReducer,
student: studentInfo,
});
有错误
Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.
@ justinlazaro-ubidy:
这是一个错误跟踪器,而不是支持系统。 对于使用方面的问题,请使用Stack Overflow或Reactiflux,那里有很多人愿意帮助您-您可能会更快地得到更好的答案。 谢谢!
最有用的评论
当然,这是个好主意。