Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 475 Bytes

parentheses.md

File metadata and controls

30 lines (25 loc) · 475 Bytes


Parentheses

  • Wrap JSX tags in parentheses when they span more than one line:
/// bad
render() {
  return <MyComponent className="long body" foo="bar">
           <MyChild />
         </MyComponent>;
}

// good
render() {
  return (
    <MyComponent className="long body" foo="bar">
      <MyChild />
    </MyComponent>
  );
}

// good, when single line
render() {
  const body = <div>hello</div>;
  return <MyComponent>{body}</MyComponent>;
}