[英]How to fix “Unexpected block statement surrounding arrow body; move the returned value immediately after the =>” ESLint error?
[英]How to fix a block statement from a eslint arrow body error?
我有以下内容:
const MyPage = (props) => {
return (
<MyLayout {...props}>
...
我需要将道具传递给MyLayout,问题是eslint不喜欢这样,并且拒绝了代码w:
箭头主体周围出现意外的语句
如何获得功能来传递道具并遵守eslint?
谢谢
问题不在于道具,而在于箭身周围,当您仅在箭身内放回时,就不需要花括号或退回。
这将起作用。
const MyPage = (props) => <div> <MyLayout {...props}> .... </MyLayout> <MyComponent /> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.