react-transition-group icon indicating copy to clipboard operation
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.

Open youjia727 opened this issue 1 year ago • 5 comments

react18.3.1 indicates that findDOMNode is deprecated 图片

youjia727 avatar May 17 '24 07:05 youjia727

@youjia727 Seems that you didn't pass nodeRef prop, referencing DOM element needs to transition. Check it out on the documentation –nodeRef

arudenkoofficial avatar May 20 '24 15:05 arudenkoofficial

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

pzm666 avatar Jun 19 '24 01:06 pzm666

Is there a PR up for this yet? It seems react-transition-group doesn't work with v19 beta.

sscaff1 avatar Jun 28 '24 12:06 sscaff1

you can use nodeRef prop image

turnflowerdown avatar Jul 02 '24 07:07 turnflowerdown

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>
  )
}

wp993080086 avatar Dec 30 '24 03:12 wp993080086