Redux: Safe state updates in reducers
Below is correct way of updating state in reducers. Reason why we are doing it this way is, that we want to create new state in memory. Then Redux
knows that something has changed and React
can rerender app.
With examples on the left we are referencing the same array/object.
With examples on the right we are creating new array/object.
_.omit
is using lodash library
, available at lodash.com