简体   繁体   English

ESLint React错误箭头主体周围出现意外的块语句

[英]ESLint React error Unexpected block statement surrounding arrow body

const App = () => {
    return (
        <div className="app">
            <div className="landing">
                <h1>svideo</h1>
                <input type="text" placeholder="Search" />
                <a>or Browse All</a>
            </div>
        </div>
    );
};

Using AirBnB config. 使用AirBnB配置。 Getting this error in react component using JSX 使用JSX在React组件中获取此错误

4:19 error Unexpected block statement surrounding arrow body arrow-body-style 4:19错误围绕箭头主体arrow-body-style的意外阻止语句

When you just return without any other logic, the eslinter wants you to remove the block and use the implicit return: 当您只返回而没有任何其他逻辑时,eslinter希望您删除该块并使用隐式返回:

const App = () => (
  <div className="app">
     <div className="landing">
        <h1>svideo</h1>
        <input type="text" placeholder="Search" />
        <a>or Browse All</a>
     </div>
  </div>
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM