Sometimes you have a gearbox that does not return a new state based on the payload. An example is an action that switches something in a state. The gearbox just had to know that the action was started to switch ownership. Example:
const lightSwitch = (
state = {on: false},
action,
) => {
switch (action.type) {
case TOGGLE:
return { ...state, on: !state.on };
default: return state;
}
}
source
share