Warning: ReactDOM.findDOMNode is deprecated and will be removed
Error message
ReactDOM.findDOMNode is deprecated and will be removed in a future version of React.
Quick summary
You called `ReactDOM.findDOMNode()` which is deprecated. Use refs attached to DOM elements instead.
Why this happens
Used
ReactDOM.findDOMNode(this)in a class componentCopied from legacy React code
Minimal example
✗ Broken code
const node = ReactDOM.findDOMNode(this); // Deprecated!✓ Fixed code
const myRef = useRef(null);
// Attach: <div ref={myRef} />
// Access: myRef.currentRefs are the modern, supported way to access DOM nodes. findDOMNode is removed in React 19.
How to diagnose
Search for
findDOMNodein the codebaseIdentify what DOM node it was trying to access
How to fix
Use a ref:
this.myRef = React.createRef()andref={this.myRef}For function components:
const myRef = useRef(null)Access the node via
myRef.current
How to prevent
Never use findDOMNode — always use refs
Use callback refs or useRef for DOM access