bindActionCreators 的Redux文档指出:
唯一的用例
bindActionCreators是当您想要将一些动作创建者传递给不知道 Redux 的组件,并且您不想将 dispatch 或 Redux 存储传递给它时。
什么bindActionCreators是使用/需要的示例?
哪种组件不知道Redux?
两种选择的优缺点是什么?
//actionCreator
import * as actionCreators from './actionCreators'
function mapStateToProps(state) {
  return {
    posts: state.posts,
    comments: state.comments
  }
}
function mapDispatchToProps(dispatch) {
  return bindActionCreators(actionCreators, dispatch)
}
对比
function mapStateToProps(state) {
  return {
    posts: state.posts,
    comments: state.comments
  }
}
function mapDispatchToProps(dispatch) {
  return {
    someCallback: (postId, index) => {
      dispatch({
        type: 'REMOVE_COMMENT',
        postId,
        index
      })
    }
  }
}