title: Why can't modify the nestState directly?
body: <p>In <a href="http://redux.js.org/docs/recipes/reducers/ImmutableUpdatePatterns.html" rel="nofollow noreferrer">redux docs</a> I see this:</p>
  <blockquote>
  <h3>Common Mistake #1: New variables that point to the same objects</h3>
  <p>Defining a new variable does not create a new actual object - it only creates another reference to the same object. An example of this error would be:</p>
  </blockquote>
  <pre><code>function updateNestedState(state, action) {
      let nestedState = state.nestedState;
  
      // ERROR: this directly modifies the existing object reference - don't do this!
      nestedState.nestedField = action.data;
  
      return {
          ...state,
          nestedState
      };
  }
  </code></pre>
  <blockquote>
  <p>This function does correctly return a shallow copy of the top-level state object, but because the <code>nestedState</code> variable was still pointing at the existing object, the state was directly mutated.</p>
  </blockquote>
  <p>But we know that <code>combineReducers</code> just judge the state change by the top-level reference.See redux <a href="https://github.com/reactjs/redux/blob/master/src/combineReducers.js" rel="nofollow noreferrer">comBindReducer.js src</a>:</p>
  <pre><code>let hasChanged = false
  const nextState = {}
  
  for (let i = 0; i &lt; finalReducerKeys.length; i++) {
    const key = finalReducerKeys[i]
    const reducer = finalReducers[key]
    const previousStateForKey = state[key]
    const nextStateForKey = reducer(previousStateForKey, action)
  
    if (typeof nextStateForKey === 'undefined') {
      const errorMessage = getUndefinedStateErrorMessage(key, action)
      throw new Error(errorMessage)
    }
  
    nextState[key] = nextStateForKey
    hasChanged = hasChanged || nextStateForKey !== previousStateForKey
  }
  
  return hasChanged ? nextState : state
  </code></pre>
  <p>It just access every reducer and judge whether the state reference changed.</p>
  <p>So back to the question,the retured object reference is changed,so the the <code>hasChanged</code> variable is true,and redux works fine.So I don't know what's the side effect of state was directly?</p>
  <p>If you know,please tell me,thanks.</p>