gpt4 book ai didi

javascript - ES6 Fat arrow in react this.setState ESLint 错误

转载 作者:行者123 更新时间:2023-11-29 20:57:00 29 4
gpt4 key购买 nike

<分区>

我在 react 中有一个小代码

this.setState((prevState) => {
return { userAnnotations: [...prevState.userAnnotations, selText] };
});

当 ES Lint 给出错误时,我如何将其转换为单行 [eslint] Unexpected block statement around arrow body;将返回值括起来并立即将其移动到 => 之后。 (箭头体式)

我试图删除 return 周围的大括号,但随后发生了另一个错误。

请帮忙。

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com