I'm using CSSTransition
and it works amazing with components:
<CSSTransition timeout={330} in={state.isPopupOpen} classNames="popup" unmountOnExit>
<MyComponent />
</CSSTransition>
I was wondering if I can use CSSTransition
to have a nice transition when I open/close a page by Route
:
<BrowserRouter>
<Switch>
<Route path="/page1">
<CSSTransition timeout={330} in={state.isPageOpen} classNames="page" unmountOnExit>
<Page1 />
</CSSTransition>
</Route>
<Route path="/page2">
<Page2 />
</Route>
<Switch>
</BrowserRouter>
<Link to="/page1">Link example</Link>
I tried it without any success. Is it not possible using CSSTransition
in this way? Do you have another similar solution?