简体   繁体   中英

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. Getting this error in react component using JSX

4:19 error Unexpected block statement surrounding arrow body arrow-body-style

When you just return without any other logic, the eslinter wants you to remove the block and use the implicit return:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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