为什么这个能够工作:
但是这个不行:
收到这个错误:
尽管在项目的其他地方扩展操作是有效的:
return elements.map((e)=> {return Object.assign({}, e, {selected:true})});
但是这个不行:
return elements.map((e)=> {...e, {selected: true}});
?
新手ES6 / Babel / React,求放过。
更新: 按照建议,迁移到此后:
return elements.map(e => ({...e, selected: true }));
收到这个错误:
![unexpected token](https://istack.dev59.com/nvcd5.webp)
return [
...state,
element(undefined, action)
]
return
? - Sebastian Simon