Reactjs React插件过渡组&;react router-JS页面转换动画

Reactjs React插件过渡组&;react router-JS页面转换动画,reactjs,react-router,Reactjs,React Router,如何将过渡组的JS变体与React Router一起使用。我在顶级react router组件中有如下所示的代码,但子路由中不会触发组件willleave()事件: <TransitionGroup> {this.props.children} </TransitionGroup> {this.props.children} 给路由一个密钥解决了问题: const ChildRoutes = React.cloneElement(this.props.chil

如何将过渡组的JS变体与React Router一起使用。我在顶级react router组件中有如下所示的代码,但子路由中不会触发
组件willleave()
事件:

<TransitionGroup>
    {this.props.children}
</TransitionGroup>

{this.props.children}

给路由一个密钥解决了问题:

const ChildRoutes = React.cloneElement(this.props.children, {
            key: this.props.location.pathname,
        })