Turns an object whose values are action creators, into an object with the * same keys, but with every function wrapped into a `dispatch` call so they * may be invoked directly. This is just a convenience method, as you can call * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. 以上是一段源码的注释,意思是我们不需要使用dispatch了,,调用bindActionCreators后返回的action就可以了,返回action集合对象中所有action方法都被包了一层dispatch
function bindActionCreator(actionCreator, dispatch) { return (...args) => dispatch(actionCreator(...args))}
这里是关键源码,就是帮你包了一层dispatch。一般配合
mapDispatchToProps把action传到props里面,然后直接this.props.someAction(someArgs)就等同于,你dispatch(someAction(someArgs)); 欢迎讨论,如果不正,劳请指出