If you upgraded a project to React 19 and an animation now crashes the moment it starts, you have probably seen one of these:
TypeError: _reactDom.default.findDOMNode is not a function
TypeError: (0 , a.findDOMNode) is not a function
TypeError: react_dom__WEBPACK_IMPORTED_MODULE_1__.findDOMNode is not a function
They are the same error with different bundler names in front. Often the stack trace mentions Transition, CSSTransition, performEnter or onTransitionEnd. It usually happens when something opens, closes, fades or collapses, not on first render. That is why it can slip past a quick smoke test.
Why it happens
React 19 removed ReactDOM.findDOMNode (see the React 19 upgrade guide). It had been deprecated in StrictMode for years.
react-transition-group needs the real DOM node to add classes and listen for transitionend. When you don't give it that node, it falls back to findDOMNode(this). On React 19 that function no longer exists, so the transition throws.
Verified on npm, 2026-11-16 (Asia/Shanghai):
- react-transition-group 4.4.5, published 2022-08-01, still the latest version.
- react / react-dom 19.3.1.
The library already has the fix built in. Since 4.4.0 (May 2020), every transition component accepts a nodeRef prop. When you pass it, react-transition-group never calls findDOMNode.
Many thanks to the react-transition-group authors and maintainers, including Jason Quense, Matija Marohnić and the reactjs community contributors. This library has quietly animated a huge part of the React ecosystem for years. The nodeRef escape hatch they added in 2020 is exactly what makes React 19 work today.
Fix 1: pass nodeRef (your own code)
Create a ref, pass it as nodeRef, and attach the same ref to the element you are animating.
CSSTransition
import { useRef } from "react";
import { CSSTransition } from "react-transition-group";
export function FadeBox({ show }: { show: boolean }) {
const nodeRef = useRef<HTMLDivElement>(null);
return (
<CSSTransition in={show} timeout={200} classNames="fade" nodeRef={nodeRef} unmountOnExit>
<div ref={nodeRef}>Hello</div>
</CSSTransition>
);
}
Transition (render-prop style)
import { useRef } from "react";
import { Transition } from "react-transition-group";
export function Slide({ open }: { open: boolean }) {
const nodeRef = useRef<HTMLDivElement>(null);
return (
<Transition in={open} timeout={300} nodeRef={nodeRef} onEnter={(isAppearing: boolean) => console.log("enter", isAppearing)}>
{(state) => <div ref={nodeRef} className={`slide slide-${state}`}>Panel</div>}
</Transition>
);
}
Watch the callback signatures. With nodeRef, the callbacks no longer receive the DOM node as their first argument:
-
onEnter(node, isAppearing)becomesonEnter(isAppearing). The same goes foronEntering,onEntered,onExit,onExitingandonExited. -
addEndListener(node, done)becomesaddEndListener(done).
If you used the node inside a callback, read nodeRef.current instead. Code that still expects (node, isAppearing) won't crash, but it will quietly get a boolean where it expected an element.
The ref has to end up on a DOM element. If the child is your own component, forward the ref to its root element. In React 19 you can accept ref as a normal prop; on older versions, use forwardRef.
SwitchTransition: one ref per key
SwitchTransition keeps the old child mounted while the new one enters. If both children share one ref, the transition reads the wrong element. Give each key its own ref:
import { useRef, useState } from "react";
import { CSSTransition, SwitchTransition } from "react-transition-group";
export function Toggle() {
const [on, setOn] = useState(false);
const onRef = useRef<HTMLButtonElement>(null);
const offRef = useRef<HTMLButtonElement>(null);
const nodeRef = on ? onRef : offRef;
return (
<SwitchTransition>
<CSSTransition key={on ? "on" : "off"} nodeRef={nodeRef} timeout={150} classNames="fade">
<button ref={nodeRef} onClick={() => setOn((v) => !v)}>{on ? "On" : "Off"}</button>
</CSSTransition>
</SwitchTransition>
);
}
TransitionGroup: one ref per item
In a list, every item needs its own ref, and that ref must stay stable while the item is leaving. Hooks can't be called inside .map(), so a simple pattern is to create the ref together with the item and keep it in your state:
import { createRef, useState, type RefObject } from "react";
import { CSSTransition, TransitionGroup } from "react-transition-group";
type Item = { id: string; text: string; nodeRef: RefObject<HTMLLIElement | null> };
export function TodoList() {
const [items, setItems] = useState<Item[]>([
{ id: "1", text: "Buy milk", nodeRef: createRef<HTMLLIElement>() },
]);
const add = () =>
setItems((xs) => [...xs, { id: String(Date.now()), text: "New", nodeRef: createRef<HTMLLIElement>() }]);
return (
<>
<button onClick={add}>Add</button>
<TransitionGroup component="ul">
{items.map(({ id, text, nodeRef }) => (
<CSSTransition key={id} nodeRef={nodeRef} timeout={200} classNames="item">
<li ref={nodeRef} onClick={() => setItems((xs) => xs.filter((x) => x.id !== id))}>{text}</li>
</CSSTransition>
))}
</TransitionGroup>
</>
);
}
ReplaceTransition works the same way: put a nodeRef on each of its children.
I ran all four snippets with React 19.3.1, react-dom 19.3.1 and react-transition-group 4.4.5 (in jsdom): they mount, enter and exit with no error. They also type-check with @types/react 19 and @types/react-transition-group 4.4.12. The same components without nodeRef throw findDOMNode is not a function.
Fix 2: when the crash comes from a UI library
If the stack trace points into node_modules/<some-ui-library>, you can't add nodeRef yourself. The library has to do it. Here is what I tested with React 19.3.1. Each component was rendered, opened and closed once:
| Library (version tested) | Result on React 19 |
|---|---|
@material-ui/core 4.12.4 (MUI v4) |
Crashes (Collapse, Fade) |
react-bootstrap 1.6.8 |
Crashes (Collapse, Fade) |
react-bootstrap 2.10.10 |
OK (Collapse, Fade, Modal) |
@mui/material 9.5.0 |
OK (Collapse, Fade) |
reactstrap 9.2.3 |
OK (Collapse, Fade, Alert, Modal, Toast) |
@blueprintjs/core 6.23.0 |
OK (Overlay2, Collapse) |
react-select 5.10.2 (react-select/animated) |
OK |
So the fixes are:
-
MUI v4 (
@material-ui/core): v4 only declares support for React 16 and 17. Move to@mui/material(v5 and later declare React 19 support; 9.5.0 tested above) with the official v4 → v5 migration guide. - react-bootstrap 1.x: upgrade to react-bootstrap 2.x (2.10.10 tested above; migration notes).
- Any other library: check its React 19 notes or changelog for "findDOMNode" or "nodeRef". Your other option is to keep that part of the app on React 18.3 until the library ships a fix.
To find out which package actually pulls in react-transition-group:
npm ls react-transition-group
# or
pnpm why react-transition-group
Fix 3: stay on React 18 for now
If an important dependency hasn't caught up and you can't replace it yet, stay on React 18.3. There findDOMNode still exists and only warns in StrictMode. It's a stopgap, not a fix.
Alternatives, if you are rewriting animations anyway
You don't have to drop react-transition-group: with nodeRef it works fine on React 19. If you are rewriting your animations anyway, these are common choices:
- Plain CSS transitions plus a mounted/unmounted state. Often enough for simple fades and slides.
-
motion (formerly Framer Motion), for
AnimatePresence-style enter/exit animations. - react-transition-state, a small hook-based state machine with an API that resembles react-transition-group.
Summary
-
findDOMNode is not a functionwith react-transition-group on React 19 means a transition has nonodeRef. - In your own code: add
nodeRefand put the same ref on the DOM element. Use one ref per key inSwitchTransitionand one per item inTransitionGroup. Callbacks then no longer get the node as an argument. - From a UI library: upgrade it (MUI v4 →
@mui/material, react-bootstrap 1 → 2), or stay on React 18.3 until it's fixed.
Top comments (0)