title: ngrx Reducer - correct way to return new state
body: <p>I am using ngrx/store in my Angular 5 project. The Application state I store looks something like this </p>
  
  <pre><code>class AppState{
      private customerList: Customer [];
      private selectedCustomer: Customer;
      private countriesOperational: Country [];
  }
  </code></pre>
  
  <p>I have individual reducers for each property of the state object, so I can listen to changes individually for each property. This state is then exposed via a service to the application components.</p>
  
  <p>In my reducer (SelectedCustomerReducer), one of the actions is to <strong>replace</strong> the currently selected customer (2nd property above) with a new Customer object. I am confused about how the reducer should return the new value.</p>
  
  <p>My reducer, already gets a new Customer object in the <code>action.payload</code>; so should i just return that as the new state?</p>
  
  <p>For e.g.</p>
  
  <pre><code>export function SelectedCustomerReducer(state: Customer = new Customer(), action: Action){
      switch(action.type){
          case 'updateSelectedCustomer':
                 return action.payload; 
                 //OR               
                 return Object.assign({}, state, action.payload);
      }
  }
  </code></pre>