Why is this working:
return elements.map((e)=> {return Object.assign({}, e, {selected:true})});
But this doesn't:
return elements.map((e)=> {...e, {selected: true}});
?
New to ES6 / Babel / React, have mercy.
UPDATE: After moving to this (as suggested):
return elements.map(e => ({...e, selected: true }));
Though the spread is working elsewhere in the project:
return [
...state,
element(undefined, action)
]