August 2017
Beginner
374 pages
10h 41m
English
A very common mistake is only copying one level of a nested object.
Consider the following example:
const brokenReducer = (state, action) => { let newState = { ...state } newState.nestedState.nestedField = action.data return newState}
In this case, the preceding highlighted line modifies the original state.nestedState object because we only made a shallow copy of the root object.
Read now
Unlock full access