title: What does { ...obj1, obj2 } do exactly
body: <p>Let's say we have two objects:</p>
  
  <pre><code>const state = {
    fishes: { /* some obj data */ },
    animals: { /* some obj data  */ }
  
  const animals = { /* some NEW data */ }
  </code></pre>
  
  <p>In Vuex there is a method replaceState(), which according to the <a href="https://vuex.vuejs.org/api/#replacestate" rel="nofollow noreferrer">documentation</a> takes one argument and replaces the state with that object.</p>
  
  <p>What will be the result of the following:</p>
  
  <pre><code>replaceState({ ...state, animals })
  </code></pre>
  
  <p>More specifically, what does <code>{ ...state, animals }</code> do exactly?</p>
  
  <p>To bring some context, I took this example from the answer of <a href="https://stackoverflow.com/questions/52815876/how-to-deep-clone-the-state-and-roll-back-in-vuex?noredirect=1&amp;lq=1">this</a> question. In that question, the user wanted to replace the <code>animals</code> property of the state with the new object <code>animals</code>.</p>
  
  <p>I'm not sure if this is relevant to Vuex / Vue.js, or is it a pure JS question, but I'll tag it with vue.js anyway.</p>