Skip to content

react/no-find-dom-node Correctness ​

✅ This rule is turned on by default.

What it does ​

This rule disallows the use of findDOMNode.

Why is this bad? ​

findDOMNode is an escape hatch used to access the underlying DOM node. In most cases, use of this escape hatch is discouraged because it pierces the component abstraction. It has been deprecated in StrictMode.

Example ​

jsx
class MyComponent extends Component {
  componentDidMount() {
    findDOMNode(this).scrollIntoView();
  }
  render() {
    return <div />;
  }
}

How to use ​

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

bash
oxlint --deny react/no-find-dom-node
json
{
  "rules": {
    "react/no-find-dom-node": "error"
  }
}

References ​

Released under the MIT License.