ESLint Airbnb ES6和Redux异步操作箭头主体周围出现意外的语句 [英] ESLint Airbnb ES6 and Redux Async Action Unexpected block statement surrounding arrow body
本文介绍了ESLint Airbnb ES6和Redux异步操作箭头主体周围出现意外的语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我做错了什么?我喜欢其他三个具有相同问题且无法修复的异步操作.
What am I doing wrong? I have like three other async actions that have the same issue and can't fix it.
推荐答案
当您查看箭头主体周围的意外的块语句"仅表示您的箭头函数不需要{ return expression; }
块,因为箭头函数默认会返回.
the "Unexpected block statement surrounding arrow body" just means that you don't need a { return expression; }
block for your arrow function here, as the arrow function does return by default.
const getOptions = () => (dispatch, getState) => {}
等效于
const getOptions = () => { return (dispatch, getState) => {} }
因此没有必要使用block语句
and therefore the block statement is unnecessary
这篇关于ESLint Airbnb ES6和Redux异步操作箭头主体周围出现意外的语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文