Skip to main content
interlace
Plugin: react-featuresRules

no-render-return-value

no-render-return-value rule

Prevent using the return value of ReactDOM.render(). This rule is part of eslint-plugin-react-features.

Quick Summary

AspectDetails
SeverityError (deprecated)
Auto-Fix❌ No (requires refactoring)
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForReact 18+ migration

Rule Details

ReactDOM.render() returns the root component instance, but this is deprecated and doesn't work with concurrent mode.

Why This Matters

IssueImpactSolution
⚠️ DeprecatedRemoved in React 18+Use refs
🔄 Concurrent modeDoesn't workcreateRoot API
🐛 UnreliableMay return nullProper patterns

Examples

❌ Incorrect

const instance = ReactDOM.render(<App />, container);
instance.doSomething();  // Using return value

✅ Correct

// React 18+ with createRoot
import { createRoot } from 'react-dom/client';

const root = createRoot(container);
root.render(<App />);

// Use refs for component instances
const appRef = React.createRef();
root.render(<App ref={appRef} />);

// Access via ref
appRef.current?.doSomething();

Configuration Examples

Basic Usage

{
  rules: {
    'react-features/no-render-return-value': 'error'
  }
}

Further Reading

Known False Negatives

  • Other uses of the value: ReactDOM.render(...).focus(), ReactDOM.render(...) && x or an arrow's implicit return (() => ReactDOM.render(...)) are not reported; only a variable initialiser, an assignment, a return and an argument are.
  • A bare render the file never imports names no module and is not read.

Use this rule

npm install -D oxlint-plugin-react-features
.oxlintrc.json
{  "jsPlugins": ["oxlint-plugin-react-features"],  "rules": {    "react-features/no-render-return-value": "error"  }}
vite.config.ts
import { defineConfig } from 'vite-plus';export default defineConfig({  lint: {    jsPlugins: ['oxlint-plugin-react-features'],    rules: {      'react-features/no-render-return-value': 'error',    },  },});

oxlint-plugin-react-features re-exports eslint-plugin-react-features/oxlint: the same rules under the same IDs, and no ESLint install. Why oxlint.

Did this rule catch something? Star the repo to get new CWE coverage as we ship it — or follow the AI-code-security benchmarks behind these rules.