score:2

Accepted answer

redux injects dispatch (implicitly) to your actions in connect:

export default connect(state => ({
  ...state.center,
}),{
  ...actions,
})(center);

if we abstract this a bit, we can watch how it happens (explicitly):

function mapdispatchtoprops(dispatch) {
    return {
        getcenters: () => dispatch(getcenters())
    }
}

export default connect(state => ({
  ...state.center,
}), mapdispatchtoprops)(center);

as a result, getcenters gets equipped with dispatch.


Related Query

More Query from same tag