title: React object spread (ES6) returned from map
body: <p>Why is this working:</p>
  
  <pre><code>return elements.map((e)=&gt; {return Object.assign({}, e, {selected:true})});
  </code></pre>
  
  <p>But this doesn't:</p>
  
  <pre><code>return elements.map((e)=&gt; {...e, {selected: true}});
  </code></pre>
  
  <p>?</p>
  
  <p>New to ES6 / Babel / React, have mercy.</p>
  
  <p>UPDATE:
  After moving to this (as suggested):</p>
  
  <pre><code>return elements.map(e =&gt; ({...e, selected: true }));
  </code></pre>
  
  <p>Get this error:
  <a href="https://i.stack.imgur.com/nvcd5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nvcd5.png" alt="unexpected token"></a></p>
  
  <p>Though the spread is working elsewhere in the project:</p>
  
  <pre><code>        return [
              ...state,
              element(undefined, action)
          ]
  </code></pre>