小编ali*_*ali的帖子

箭头函数参数周围的预期括号。(箭头括号)

如何避免ES7箭头函数上的流型错误

handleSelectCategory = (e) => {
  const { form } = this.state;

  let newCategories = [];
  if (form.categories.findIndex((c) => c.value === e.value) >= 0) {
    newCategories = form.categories.filter((c) => c.value !== e.value);
  } else {
    newCategories = [...form.categories, e];
  }
  this.setState({
    form: Object.assign({}, form, { categories: newCategories }),
  });
};
Run Code Online (Sandbox Code Playgroud)

我收到警告

Expected parentheses around arrow function argument. (arrow-parens)
Run Code Online (Sandbox Code Playgroud)

javascript reactjs eslint

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

eslint ×1

javascript ×1

reactjs ×1