findDOMNode warning in StrictMode, or findDOMNode missing in React 19
Warning: findDOMNode is deprecated in StrictModeShort answer
findDOMNode was deprecated in React 16.6 and is removed in React 19. The fix is a ref: createRef in a class component, useRef in a function component, and forwardRef when you need a child's DOM node. A library that still calls it must be replaced or updated.
Fix it fast
1Find out which cause you have
Find out whether your own code or a package calls it. The stack in the warning names the component.
grep -rn "findDOMNode" src grep -rln "findDOMNode" node_modules --include=*.js | head2Match what you see, then jump to its fix
- 1
The warning names one of your own componentsA class component calls findDOMNode(this)Fix - 2
findDOMNode is imported from react-dom in a function componentA function component imports findDOMNodeFix - 3
findDOMNode(this.child) or a wrapper that reaches into a childYou need the DOM node of a child componentFix
- 1
What does the error look like?
Warning: findDOMNode is deprecated in StrictModefindDOMNode was passed an instance of Transition which is inside StrictModeThe app breaks on findDOMNode after upgrading to React 19, where it was removed
Cause 1 of 3
A class component calls findDOMNode(this)
1Check
findDOMNode only accepts class component instances. Wrapping the render output in a new element changes what it returns, which is why it is fragile.
grep -rn "findDOMNode(this)" src2Fix
Create a ref as a class field, attach it to the element and read current after mount.
class Form extends React.Component {
inputRef = React.createRef();
componentDidMount() { this.inputRef.current.focus(); }
render() { return <input ref={this.inputRef} />; }
}3Verify
Run the app in StrictMode; the warning disappears.
npm run devConfirmed by 18.react.dev
Cause 2 of 3
A function component imports findDOMNode
1Check
React 19 removed ReactDOM.findDOMNode. Its replacement is a DOM ref.
grep -rn "from 'react-dom'" src | grep findDOMNode2Fix
Use useRef and read ref.current inside an effect.
function AutoselectingInput() {
const ref = useRef(null);
useEffect(() => {
ref.current.select();
}, []);
return <input ref={ref} defaultValue="Hello" />;
}3Verify
The input is selected on mount and no warning appears.
npm run devConfirmed by react.dev
Cause 3 of 3
You need the DOM node of a child component
1Check
Reaching into a child breaks abstraction. The child must hand its node to the parent.
grep -rn "findDOMNode(" src2Fix
Create a ref in the parent and pass it down through a component wrapped in forwardRef. For measuring or scrolling a group of children, wrap them in a div with a ref, accepting that extra wrappers can affect styling.
const MyInput = forwardRef((props, ref) => <input {...props} ref={ref} />);
function Parent() {
const ref = useRef(null);
return <MyInput ref={ref} />;
}3Verify
The parent can read ref.current after mount.
npm run devConfirmed by 18.react.dev
How do I stop it coming back?
- Treat the StrictMode warning as a to do item; the API is gone in React 19.
- Check dependencies against the React 19 upgrade guide before upgrading.
- Use refs for DOM access in new code.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
Module not found for antd/dist/antd.less after upgrading to Ant Design 5
Module not found: Error: Can't resolve 'antd/dist/antd.less'
Ant Design 5 dropped Less and the bundled CSS file for CSS-in-JS, so antd/dist/antd.less no longer exists.
3 causes, each with a fixWeb apps
Astro Code component fails inside a React component
Astro components cannot be rendered directly via function call
Astro components such as Code only exist on the server and render static HTML.
2 causes, each with a fixWeb apps
React shows Attempted import error when importing a component or function
Attempted import error:
The build found the file but not the name you asked for.
2 causes, each with a fixWeb apps
How to catch and handle a 422 from Axios in a Redux thunk
action.error.message is 'Rejected' and action.payload is undefined
A 422 means the server read the request but cannot process its content, so repeating it unchanged fails again.
4 causes, each with a fixWeb apps
axios gets 429 Too Many Requests from a React app
429 (Too Many Requests)
A 429 comes from the server or an API gateway, not from axios: your client sent too many requests in a window.
4 causes, each with a fixWeb apps
Axios request is not cancelled when a React component unmounts
A cancelled request is logged as an error in the catch block
Axios cancels a request when you pass it an AbortSignal and later call abort() on its controller.
4 causes, each with a fix