A case reducer is a reducer function for a specific action type. Case
reducers can be composed to full reducers using createReducer().
Unlike a normal Redux reducer, a case reducer is never called with an
undefined state to determine the initial state. Instead, the initial
state is explicitly specified as an argument to createReducer().
In addition, a case reducer can choose to mutate the passed-in state
value directly instead of returning a new state. This does not actually
cause the store state to be mutated directly; instead, thanks to
immer, the mutations are
translated to copy operations that result in a new state.
A case reducer is a reducer function for a specific action type. Case reducers can be composed to full reducers using
createReducer()
.Unlike a normal Redux reducer, a case reducer is never called with an
undefined
state to determine the initial state. Instead, the initial state is explicitly specified as an argument tocreateReducer()
.In addition, a case reducer can choose to mutate the passed-in
state
value directly instead of returning a new state. This does not actually cause the store state to be mutated directly; instead, thanks to immer, the mutations are translated to copy operations that result in a new state.