title: How To Mutate Array Of Objects In Vue
body: <p>I am trying to mutate my array after updating objects with the new values. Currently when I use <code>splice()</code> it has been for only mutating single object. Perhaps I am looking for simple javascript method but I am trying to figure out how mutate array if I am updating multiple objects simultaneously?</p>
  
  <p>This is the store action I am using to <code>commit</code> response.data</p>
  
  <pre><code>updateCheckedEngagements(context, checkedEnagements) {  
        axios.patch('/engagementsarray', {
          engagements: checkedEnagements.engagements,
          assigned_to: checkedEnagements.assigned_to,
          status: checkedEnagements.status
        })
        .then(response =&gt; {
            console.log(response.data)
            context.commit('updateCheckedEngagements', response.data)
        })
        .catch(error =&gt; {
            console.log(error.response.data)
        })           
      },
  </code></pre>
  
  <p>here is the mutation I have currently set up but I do not think it is correct</p>
  
  <pre><code>    updateCheckedEngagements(state, engagement) {
            const index = state.engagements.findIndex(item =&gt; item.id == engagement.id);
            state.engagements.splice(index, 1, {
              'id': engagement.id,
              'assigned_to': engagement.assigned_to,
              'status': engagement.status,
            })
          },
  </code></pre>
  
  <p>Also since I am passing <code>checkedEngagements</code> as my parameter in the store action, does that also have to be the 2nd parameter for the mutation?</p>