I'm unable to call dispatch function when I try to use bindActionCreators
Dispatch Function not working:
@connect(state => ({oPurchaseDetails: state.cart.cartItems}), dispatch => bindActionCreators({updateItem}, dispatch))
If I don't use bindActionCreators, updateItem function doesn't work.
updateItem Function not working:
@connect(state => ({oPurchaseDetails: state.cart.cartItems}), dispatch => ({updateItem, dispatch}))
connect only inserts this.props.dispatch automatically if you do not supply a mapDispatch function. Because you're using your own mapDispatch, you are responsible for including that in the return value.
See http://redux.js.org/docs/faq/ReactRedux.html#react-props-dispatch for further details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With