React: Expected an assignment or function call and instead saw an expression

前端 未结 8 1361
一个人的身影
一个人的身影 2020-11-27 05:40

I am trying to fix this lint error at line const def = (props) => { in following sample code.

const propTypes = {
prop1: PropTypes.string,
pr         


        
8条回答
  •  独厮守ぢ
    2020-11-27 06:18

    The return statements should place in one line. Or the other option is to remove the curly brackets that bound the HTML statement.

    example:

    return posts.map((post, index) =>
        

    {post.title}

    {post.body}

    );

提交回复
热议问题