If a transition feels too fast or slow, adjust its duration in 25ms increments until it strikes the right balance. (Jonas Naimark of Google Design 2018)
Use the location prop for the Switch component to choose which Route to render. To access location prop, use the render prop of the Route component, as in Girault's demo (which isn't mentioned in the article, though).
Wrap the Switch component with <div>. See Annex A of the article.
Install React-Transition-Group and wrap the Switch component with TransitionGroup and CSSTransition like so:
TODO: Implement it in the 404 page
Design Duration: Entering 300ms / Leaving 250ms
Easing: Outgoing
cubic-bezier(0.4, 0.0, 1, 1);
(accelerated) / Incomingcubic-bezier(0.0, 0.0, 0.2, 1);
(decelerated)fade-through as choreography
(image source: https://material.io/design/motion/choreography.html#sequencing)
Outgoing elements fade out
Incoming elements fade in
Implementation
Following Nicolas Girault's article...
location
prop for theSwitch
component to choose whichRoute
to render. To accesslocation
prop, use therender
prop of theRoute
component, as in Girault's demo (which isn't mentioned in the article, though).Switch
component with<div>
. See Annex A of the article.Switch
component withTransitionGroup
andCSSTransition
like so: