我在我的项目中使用ESlint。我收到错误**来自此函数的箭头体**的意外阻止语句
const toggleDrawer = (state) => {
return {
...state,
drawerExpanded: !state.drawerExpanded,
};
};
有人可以建议我如何处理这个ESlint错误吗?
答案 0 :(得分:1)
将对象包裹在括号()
const toggleDrawer = (state) => ({
...state,
drawerExpanded: !state.drawerExpanded,
});
同时检查您是否在es-lint中有arrow-body-style: ["error", "as-needed"]