문제

I am new to react and have tried react animations. They work great when elements are added or removed in a TransitionGroup. But if I replace a single element with a similar one, react detects that the content of that element has changed and does not trigger an animation.

How can I fade out a single element and fade in a new one in the same place? For example fade out login-div, fade in dashboard-div.

도움이 되었습니까?

해결책

If your elements have different key attributes, TransitionGroup will unmount one and mount the other.

You can read more about keys here: Composition vs Inheritance.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top