Skip to main content
ESLint Interlace
Plugin: react-featuresRules

no-find-dom-node

Prevent using findDOMNode. This rule is part of eslint-plugin-react-features and provides LLM-optimized error messages.

Keywords: React, findDOMNode, deprecated, refs, ESLint rule, code quality, LLM-optimized

Prevent using findDOMNode. This rule is part of eslint-plugin-react-features and provides LLM-optimized error messages.

Quick Summary

AspectDetails
SeverityError (deprecated API)
Auto-Fix❌ No auto-fix
CategoryReact
ESLint MCP✅ Optimized for ESLint MCP integration
Best ForAll React/JSX projects

Rule Details

findDOMNode is deprecated and will be removed in future React versions. Use refs instead.

Examples

❌ Incorrect

import { findDOMNode } from 'react-dom';

class MyComponent extends React.Component {
  componentDidMount() {
    const node = findDOMNode(this);
    node.focus();
  }
}

✅ Correct

import React, { useRef, useEffect } from 'react';

function MyComponent() {
  const ref = useRef(null);

  useEffect(() => {
    ref.current?.focus();
  }, []);

  return <div ref={ref}>Content</div>;
}