A thin layer over react-motion for animating routes in react-router.
npm install react-router-transitionPainless transitions for React Router, powered by React Motion. Example site.
To use the latest version of this package (2.x), you'll need to use a version
of React compatible with hooks, as well as version 5.x of react-router-dom.
npm install --save react-router-transition react-router-dom
jsx
import { BrowserRouter as Router, Route } from 'react-router-dom';
import { AnimatedSwitch } from 'react-router-transition';export default () => (
atEnter={{ opacity: 0 }}
atLeave={{ opacity: 0 }}
atActive={{ opacity: 1 }}
className="switch-wrapper"
>
)
``css
.switch-wrapper {
position: relative;
}.switch-wrapper > div {
position: absolute;
}
``- AnimatedSwitch
- AnimatedRoute
This library has some obvious limitations, the most marked of which are:
- no staggering or sequencing of animations
- no durations or timing functions