[英]Eslint arrow-body-style error in react.js
Using Airbnb's eslint rules, I'm getting the following error in my react code but I'm not sure what's the error.使用 Airbnb 的 eslint 规则,我的反应代码中出现以下错误,但我不确定错误是什么。
const Facebook = ({ appId, url }) => {
return (
<div className={styles.facebook}>
<FacebookProvider appID={appId}>
<EmbeddedPost href={url} width="auto" />
</FacebookProvider>
</div>
)
}
Getting an error at the beginning of line 1 {
bracket.在第 1 行的开头出现错误
{
括号。
Unexpected block statement surrounding arrow body.
箭头主体周围出现意外的块语句。 (arrow-body-style)
(箭体式)
Tried wrapping the curly brackets with parenthesis brackets but in turn, another error appear around line 3 of <div>
.尝试用圆括号包裹大括号,但反过来,在
<div>
第 3 行周围出现另一个错误。
Parsing error: Unexpected token
解析错误:意外的令牌
Try removing the curly braces and the return as per the issue linked in the comment for your question:根据您的问题的评论中链接的问题,尝试删除花括号和返回:
const Facebook = ({ appId, url }) =>
<div className={styles.facebook}>
<FacebookProvider appID={appId}>
<EmbeddedPost href={url} width="auto" />
</FacebookProvider>
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.