New
Introducing React Doctor for Enterprise

react/require-render-return

Require class component render() methods to return a value — a missing return renders nothing.

Validation prompt

Use this to decide whether a fired diagnostic is real or a false positive.

Fires on a render() method whose body lacks a return statement, inside React class components (React.Component subclasses and createReactClass factories) — typically a slipped brace style like render() { <div>Hello</div>; } that returns undefined and renders nothing. Function components are out of scope. The rule is scoped to React class bodies, so an unrelated class with a render() method that intentionally returns undefined is not a false positive.

Fix prompt

Use this once validation confirms the diagnostic is real.

Add the missing return: render() { return <div>Hello</div>; }. For an arrow component using implicit return, drop the surrounding braces: () => <div>Hello</div>. If the JSX is conditional, return null in the no-render branch — React treats null as "render nothing" but treats a missing return (undefined) as a programming mistake. See https://oxc.rs/docs/guide/usage/linter/rules/react/require-render-return.html and https://react.dev/reference/react/Component#render

More Correctness rules from the rules reference:

  • react/rules-of-hooks: Enforce the Rules of Hooks: call hooks only at the top level of components and custom hooks, never in conditions or loops.
  • deslop/commonjs-in-esm: Flag CommonJS constructs (require/module.exports/exports.x) inside an ESM module.
  • deslop/lazy-import-at-top-level: Flag a dynamic import() at module top level that is awaited or .then/.catch/.finally-ed during load (no laziness benefit); prefer a static import.
  • deslop/simplifiable-expression: Disallow expressions that collapse to a simpler equivalent, e.g. !!x → Boolean(x).
  • deslop/simplifiable-function: Disallow functions written less directly than needed: block-arrow-single-return, redundant-await-return, useless-async-no-await.