delay-react-route-exit
delay-react-route-exit is a hook library for react-router-dom. It's point is to delay a route change, enough so you can apply animations to your components.
Installation
npm i delay-react-route-exit
Usage
;; const Component = { // Delay the route change by 800 ms const isExitingRoute = ; return // Apply the animation when the route starts to change // The animation length on the class should be the same length as the milliseconds // value placed in the useDelayRouteLeave function <div className=`container`> <h1>Hello world</h1> <p>Quick brown fox jumps over the lazy dog</p> </div> ;}; ;