【发布时间】:2018-07-24 22:23:54
【问题描述】:
我在反应中有一个小代码
this.setState((prevState) => {
return { userAnnotations: [...prevState.userAnnotations, selText] };
});
当 ES Lint 给出错误 [eslint] Unexpected block statement surrounding arrow body; parenthesize the returned value and move it immediately after the=>. (arrow-body-style)
我试图删除 return 周围的花括号,但随后又出现了一些错误。
请帮忙。
【问题讨论】:
-
this.setState(prevState => ({ userAnnotations: [...prevState.userAnnotations, selText] }));
标签: javascript reactjs ecmascript-6