Parentheses

  • Wrap JSX tags in parentheses when they span more than one line. eslint: react/jsx-wrap-multilines

    1. // bad
    2. render() {
    3. return <MyComponent variant="long body" foo="bar">
    4. <MyChild />
    5. </MyComponent>;
    6. }
    7. // good
    8. render() {
    9. return (
    10. <MyComponent variant="long body" foo="bar">
    11. <MyChild />
    12. </MyComponent>
    13. );
    14. }
    15. // good, when single line
    16. render() {
    17. const body = <div>hello</div>;
    18. return <MyComponent>{body}</MyComponent>;
    19. }