Last week, I made two mistakes with my Redux code.
Mistake #1: deepClone Redux state
The state within the reducer is immutable. That is, the old state should never be changed. To ensure that the old state never gets changed, I got a “cool idea”. Do a deepClone of the entire state. So, my reducer code looked like:
case ActionType.SomeAction: { const newState = deepCopy(state); newState.someArray.push('abc');…