title: How to make several fields editable in React and Redux?
body: <p>I have an object in my redux state</p>
  
  <pre><code>const obj = {
   name: 'name',
   age: 2,
   place: 0,
  }
  </code></pre>
  
  <p>I show these values on the page but I want to make two of them editable so that the object can be updated.</p>
  
  <p>For that I'm basically getting values from two inputs and sending them to my <code>action</code></p>
  
  <pre><code>export const saveEditedData = data =&gt; dispatch =&gt; {
    dispatch({
      type: CHANGE_DATA,
      data,
    });
   }
  </code></pre>
  
  <p>and then in reducer</p>
  
  <pre><code> case 'CHANGE_DATA': 
        return {
          ...state,
          obj: {
           ...state.obj,
           name: action.data.name,
           age: action.data.age,
         }
      }
  </code></pre>
  
  <p>The problem that I'm facing is that if one value is updated and another is not then after this action my second value in empty.</p>
  
  <p>My question is what is a good way to determine which field is changed and update only it?</p>
  
  <p>So far I only came up with putting <code>if else</code> in action to dispatch certain thing. Maybe there is a better way?</p>