我学习 React Redux 并在此处阅读有关使用mapDispatchToProps
和bindActionCreators
bindActionCreators
像这样单独使用它时效果很好:
export default connect(null, (dispatch) =>
bindActionCreators(actionCreators, dispatch)
)(FormContainer);
但我有更多的行动并尝试了这个:
function mapDispatchToProps(dispatch) {
return {
bindActionCreators(actionCreators, dispatch),
clearPosts: () => dispatch(clearPosts()),
}
}
这会产生如下错误:
. 我如何将它们结合起来我阅读了文档,但我对此一无所知,请咨询