Skip to content

react/no-render-return-value Correctness

This rule is turned on by default.

What it does

This rule will warn you if you try to use the ReactDOM.render() return value.

Why is this bad?

Using the return value from ReactDOM.render() is a legacy feature and should not be used.

Example

Examples of incorrect code for this rule:

jsx
vaa inst =ReactDOM.render(<App />, document.body);
function render() {
 return ReactDOM.render(<App />, document.body);
}

Examples of correct code for this rule:

jsx
ReactDOM.render(<App />, document.body);

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny react/no-render-return-value
json
{
  "rules": {
    "react/no-render-return-value": "error"
  }
}

References

Released under the MIT License.