The react router slides around the animation.Based on react-router 4 and react-transition-group
npm install react-slide-animation-routerreact router左右滑动动画的封装。
The react router slides around the animation.
bash
$ npm install react-slide-animation-router
``javascript
import { Route, Router } from 'react-router-dom'
import SlideRouter, { initSlideRouter } from 'react-slide-animation-router'
import { createBrowserHistory } from 'history'
const history = createBrowserHistory()// 必须在创建路由之前调用initSlideRouter
// The initSlideRouter must be called before the route is created
initSlideRouter({
history,
routeAnimationDuration: 350
})
const renderRouter = () => {
return (
)
}
`` history.push('/your-path', { noAnimate: true })
history.pop('/your-path', { noAnimate: true })
history.replace('/your-path', { noAnimate: true })