JS.REACT.REQUIRE.RENDER.RETURN

Enforce ES5 or ES6 class for returning value in render function

When writing the render method in a component it is easy to forget to return the JSX content. This rule will warn if the return statement is missing.

Rule Details

Examples of incorrect code for this rule:

Copy
var Hello = createReactClass({
  render() {
    <div>Hello</div>;
  }
});

class Hello extends React.Component {
  render() {
    <div>Hello</div>;
  }
}

Examples of correct code for this rule:

Copy
var Hello = createReactClass({
  render() {
    return <div>Hello</div>;
  }
});

class Hello extends React.Component {
  render() {
    return <div>Hello</div>;
  }
}

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/