score:5

Accepted answer

there is a third argument called mergeprops in connect method of react-redux which is supposed to be used in cases like one you just described. in your case you can do something like:

const mapstatetoprops = state => ({ postdata: ... });

const mapdispatchtoprops = (dispatch) => ({
  actions:  bindactioncreators(formactions, dispatch)
});

const mergeprops = (stateprops, dispatchprops) => ({
  submit: () => dispatchprops.actions.submit(stateprops.postdata),
});

const connectedcomponent = connect(mapstatetoprops, mapdispatchtoprops, mergeprops)(component);

note that component will not receive actions nor postdata, just submit.


Related Query

More Query from same tag