export function reducer(state, action) { switch (action.type) { case "onNetworkChange": { const { prop, value } = action.payload; return { ...state, network: { ...state.network, [prop]: value } }; } default: { return state; } } } export const dispatchActions = dispatch => ({ onNetworkChange: (prop, value) => dispatch({ type: "onNetworkChange", payload: { prop, value } }) });