When returning a literal object from an arrow function construct (a lambda), you have to wrap it in parentheses so that it's seen as an expression:
data.map(item => ({...item, active: false}));
map
is only useful if you need a different array.
But there's a simpler solution here. You don't have to reassign all items and data
. You should simply do
data.forEach(item => item.active=false)