react-transition-group
react-transition-group copied to clipboard
Css transition classNames get removed by react updates, if child has 'className' props
What is the current behavior?
CSSTransition add classname to child component by dom API directly, not by react. If react updates after CSSTransition adding class, CSSTransition's class names ,like 'enter-done', get removed by react props.
const [showClassNames, setshowClassNames] = useState(false);
<CSSTransition nodeRef={nodeRef} in={inProp} timeout={200} classNames="my-node">
<div
ref={nodeRef}
className={showClassNames? "anyClassName": ""}
onClick={() => {setshowClassNames(true)}
>
{"I'll receive my-node-* classes"}
</div>
</CSSTransition>
What is the expected behavior?
CSSTransition's class names remains , even if child component updates with class
Could you provide a CodeSandbox demo reproducing the bug?
https://codesandbox.io/s/morning-pond-xu2e9l