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
| Aspect | Details |
|---|---|
| Severity | Error (deprecated) |
| Auto-Fix | ❌ No (requires refactoring) |
| Category | React |
| ESLint MCP | ✅ Optimized for ESLint MCP integration |
| Best For | React 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
| Issue | Impact | Solution |
|---|---|---|
| ⚠️ Deprecated | Removed in React 18+ | Use refs |
| 🔄 Concurrent mode | Doesn't work | createRoot API |
| 🐛 Unreliable | May return null | Proper 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'
}
}Related Rules
react-class-to-hooks- Modernization
Further Reading
- React 18 - createRoot - React 18 API
- Upgrading to React 18 - Migration guide
Known False Negatives
- Other uses of the value:
ReactDOM.render(...).focus(),ReactDOM.render(...) && xor an arrow's implicit return (() => ReactDOM.render(...)) are not reported; only a variable initialiser, an assignment, areturnand an argument are. - A bare
renderthe file never imports names no module and is not read.
Use this rule
npm install -D oxlint-plugin-react-features{ "jsPlugins": ["oxlint-plugin-react-features"], "rules": { "react-features/no-render-return-value": "error" }}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.