1.Nested block is redundant no-lone-blocks
2.Unexpected string concatenation of literals no-useless-concat
拼接字符串报错 "Unexpected string concatenation" 错误原因:ESLint推荐用ES6方法来拼接字符串,而不能使用加号。 解决办法:拼接字符串使用形如: `字符串字符串字符串${变量名}字符串字符串字符串${返回字符串的方法}字符串字符串`的写法。
3.series not exists. Legend data should be same with series name or data name.
4.React Hook useEffect has a missing dependency: ‘fetchBusinesses‘. Either include it or remove the dependency array react-hooks/exhaustive-deps
这不是JS / React错误,而是eslint警告。
它告诉你钩子依赖于函数fetchBusinesses
,所以你应该把它作为依赖传递。
1.useEffect(() => {
fetchBusinesses();
}, [fetchBusinesses]);
如果fetchBusinessess
在运行中没有组件,那将不会真正改变任何事情,但警告将消失。
2.useEffect(() => { // other code ... // eslint-disable-next-line react-hooks/exhaustive-deps }, [])
参考文章:https://www.soinside.com/question/yyxQ6i8PKsVyaS3teSftxH
5.