![](/img/trans.png)
[英]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.