I'm using react-router and I want to be able to render and transition arbitrary components when mounting and unmounting. Right now I have added the components to my route definition:
<Route component={App}> <Route path="foo" component={Foo} /> <Route path="bar" component={Bar} /> </Route> I use react css transition group in my components to animate them when they enter and leave. The components mount and animate propery when they are entering. But when I leave the route, the rendered component is immediately removed and there is thus no leave animation.
The typical solution is to add the transition group to the parent so that it isnt unmounted, and from there animate the children. This doesn't work for me because Foo component and Bar component use completely different animations.
In short I believe I need a way to individually animate routes and not the typical "transition between routes". For example, navigating between / and /foo should yield the following:
- Be on
/, navigate to/foo-> theFoocomponent animates in. - Be on
/foo, navigate to anywhere else, like/-> theFoocomponent animates out.
I hope this makes sense, thanks!
