score:3

you are calling the function instead of passing its reference

export default connect(mapstatetoprops,mapdispatchtoprops())(cart);
// ------------------------------------------------------^^--------

change to this

export default connect(mapstatetoprops, mapdispatchtoprops)(cart);

an alternative is to just not use mapdispatchtoprops at all and use the dispatch your connected component receives

export default connect(mapstatetoprops)(cart);

and then using dispatch

this.props.dispatch(decrementcount())

Related Query

More Query from same tag