I'm trying to animate a component entering and leaving the dom, but I also want to animate it being replaced with another instance of itself. I tried everything on react-transition-group and nothing works as I expect. There is Transition group, which is able to handle elements leaving the dom and getting fully empty, but it is not capable of waiting for one element to leave before animating the next. I also tried SwitchTransition, but that one is not able to accept empty children, you need to always provide at least one child, which will be animated, so I can not just put a random empty div there.
I suspect that I can achieve this playing with complete callbacks, but I am unsure about how.