react-transition-group
react-transition-group copied to clipboard
findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference.
react18.3.1 indicates that findDOMNode is deprecated
@youjia727 Seems that you didn't pass nodeRef prop, referencing DOM element needs to transition. Check it out on the documentation –nodeRef
According to the React documentation, findDOMNode is about to be deprecated and removed, and needs to be replaced with a ref to read the component's own DOM node
Is there a PR up for this yet? It seems react-transition-group doesn't work with v19 beta.
you can use nodeRef prop
v4.4.0中已修复:
import React from "react"
import { CSSTransition } from "react-transition-group"
const MyComponent = () => {
const nodeRef = React.useRef(null)
return (
<CSSTransition nodeRef={nodeRef} in timeout={200} classNames="fade">
<div ref={nodeRef}>Fade</div>
</CSSTransition>
)
}