title: updating value of array of object using lodash
body: <p>My state object is:</p>
  
  <pre><code>[
      {
          traveller1_dob: '',
          traveller1_firstName:'',
          traveller1_isPreviousTraveller: false,
          traveller1_surname:'',
          traveller1_title: ''
      },
      {
          traveller2_dob: '',
          traveller2_firstName:'',
          traveller2_isPreviousTraveller: false,
          traveller2_surname:'',
          traveller2_title: ''
      }
  
  ]
  </code></pre>
  
  <p>and my payload is:</p>
  
  <pre><code>{key: "traveller1_firstName", value: "ABC", index: 0}
  </code></pre>
  
  <ul>
  <li>key is the property of the object that needs to be updated</li>
  <li>value: is the value we want to update</li>
  <li>index: is the index of the traveller in state array</li>
  </ul>
  
  <p>At the moment this is the way I updated:</p>
  
  <pre><code>let obj = state[payload.index];
  obj[payload.key] = payload.value;
  
  return _.unionBy(state, [obj], payload.key);
  </code></pre>
  
  <p>I am aware its not the best way. </p>
  
  <p>Output should be:</p>
  
  <pre><code>[
      {
          traveller1_dob: '',
          traveller1_firstName:'ABC',
          traveller1_isPreviousTraveller: false,
          traveller1_surname:'',
          traveller1_title: ''
      },
      {
          traveller2_dob: '',
          traveller2_firstName:'',
          traveller2_isPreviousTraveller: false,
          traveller2_surname:'',
          traveller2_title: ''
      }
  
  ]
  </code></pre>
  
  <p>Ideally I want to get rid of index if it's possible.How would you do this?</p>