title: In Redux, is it necessary to do deep copy
body: <p>The below object is <code>action.data</code> has a nested object <code>address</code></p>
  
  <pre><code>{
      name: 'Ben',
      address: {
          country: 'Australia',
          state: 'NSW'
      }
  }
  </code></pre>
  
  <p>How should I handle it in the reducer?</p>
  
  <pre><code>const rootReducer = (state = initState, action) {
      switch(action.type) {
          switch RECEIVE_DATA:
              return {...state, data: action.data}
      }
  }
  </code></pre>
  
  <p>Can I do it as above? that I just assign the whole object to <code>data</code> without copying?</p>
  
  <p>or</p>
  
  <pre><code>const rootReducer = (state = initState, action) {
      switch(action.type) {
          switch RECEIVE_DATA:
              const address = {...action.data.address}
              const data = {...action.data, address}
              return {...state, data}
      }
  }
  </code></pre>
  
  <p>Or should I do a deep copy of the object and assign it to <code>data</code>?
  thanks</p>