Reactjs React-在嵌套管线中使用React转换组TransitionGroup
我搜索了这个问题,但找不到本地react过渡组的解决方案 我有两个组件的家和订单。我使用路由转换来实现这些。对于这些平坦的路线,一切正常Reactjs React-在嵌套管线中使用React转换组TransitionGroup,reactjs,animation,react-router-v4,react-transition-group,Reactjs,Animation,React Router V4,React Transition Group,我搜索了这个问题,但找不到本地react过渡组的解决方案 我有两个组件的家和订单。我使用路由转换来实现这些。对于这些平坦的路线,一切正常 <TransitionGroup component={null}> <CSSTransition key={props.locationKey} classNames={["route-slide"].join(' ')} timeout={{ ente
<TransitionGroup component={null}>
<CSSTransition
key={props.locationKey}
classNames={["route-slide"].join(' ')}
timeout={{ enter: 1000, exit: 500 }}>
<div>
<Switch key={this.props.location.pathname} location={this.props.location}>
<Route path="/home" component={Home} />
<Route path="/order" component={Order} />
<Route path="*" render={({ location }) => {
if (location.pathname === window.location.pathname) {
return <Redirect to="/home" />;
}
return null;
}} />
.
.
.
{
if(location.pathname==window.location.pathname){
返回;
}
返回null;
}} />
.
.
.
我想对主组件中的子路由使用路由转换。但当我要设置子管线的动画时,始终会设置主元件的动画。您可以在下面找到子路由
<TransitionGroup component={null}>
<CSSTransition
key={props.locationKey}
classNames={["route-slide"].join(' ')}
timeout={{ enter: 1000, exit: 500 }}>
<div>
<Switch key={this.props.location.pathname} location={this.props.location}>
<Route path="/home" exact render={() => {
return <Navigations/>;
}} />
<Route path="/home/:type" component={SomeComponentByType} />
</Switch>
.
.
.
{
返回;
}} />
.
.
.
这是主组件的图像
如何仅为子管线设置动画
谢谢你的帮助你在发帖后成功了吗?如果是,你是如何做到的?这里有一个与您以前的需求相关的链接:也在搜索答案,我已经打开了一个github问题。github.com/reactjs/react-transition-group/issues/625