Reputation: 12884
Below is the first style to do a dispatch which is working fine
this.props.dispatch(functionInAction(someParam));
export default connect(mapStateToProps)(Component);
Below is another style of dispatch which should be working fine too
this.props.functionInAction(someParam);
export default connect(mapStateToProps, { functionInAction })(Home);
Now I trying to mix the style to come up with something as below
this.props.functionInAction(someParam);
this.props.dispatch(functionInAction2(someParam))
export default connect(mapStateToProps, { functionInAction })(Home);
Immediately I'm getting this.props.dispatch
is not a function?
Upvotes: 0
Views: 37
Reputation: 67539
Correct. If you supply your own mapDispatch
function or use the "object shorthand" of an object full of action creators, then the default behavior of giving props.dispatch
no longer applies.
See the Redux FAQ entry on props.dispatch
being made available to your component.
Upvotes: 1