reactjs / react-transition-group

An easy way to perform animations when a React component enters or leaves the DOM
https://reactcommunity.org/react-transition-group/
Other
10.1k stars 652 forks source link

CSSTransition appearDone being unset causes "undefined" class when in+appear are true first and enterDone is set #890

Open stevensacks opened 1 year ago

stevensacks commented 1 year ago

What is the current behavior?

If in and appear are true on first render, and classNames contains a value for enterDone and you do not provide appearDone, you get an undefined class.

Having appear set in classNames does not prevent undefined from being included. If you have enterDone and do not include appearDone, you get undefined.

What is the expected behavior?

Do not inject "undefined" class names (in any situation, not just this one).

Could you provide a CodeSandbox demo reproducing the bug?

https://codesandbox.io/s/blazing-tdd-dlmmk3?file=/src/App.js

I made a css class which turns text red so you can see visually when undefined is being included.

.undefined {
    color: #f00;
}