我已经找到了一种方法,可以在使用" React Router Transition"离开或进入时使我的组件具有动画效果。问题是我使用react-router-config
并且我想知道如何使用我的路线所在的renderRoutes(routes)
设置路线更改动画:
export default [
{
component: App,
routes: [
{
component: NewRecipe,
path: '/add-recipe'
},
{
component: RecipeList,
path: '/recipes/:page?/:sortType?/:size?'
},
{
component: Recipe,
path: '/recipe/:id'
},
{
component: SignForm,
path: '/sign'
},
{
component: User,
path:'/user/:id',
routes: [
{ path: '/user/:id/overall',
component: UserInfo
},
{ path: '/user/:id/opinions',
component: UserOpinions
},
{ path: '/user/:id/recipes',
component: UserRecipes
}
]
}
]
}
];
如何在离开/进入时为某些路线设置动画?
起初我尝试过简单的ReactCSSTransitionGroup
,但在路由时它并不起作用。