ReactCSSTransitionGroup when changing path
See original GitHub issueI can’t get transitions between pages working. I’ve tried basing my code off of the universal router example here, but it doesn’t work. I’m passing a unique path
prop to use as the unique transition key for ReactCSSTransitionGroup
to use.
I’ve also tried setting ReactCSSTransitionGroup
at every level in the Layout.js
file, and none have worked. What am I missing?
Here is my latest Layout.js
code:
render() {
const {
path,
children
} = this.props;
return (
<ReactCSSTransitionGroup
component="div"
className="container"
transitionName={{
enter: s.enter,
leave: s.leave
}}
transitionEnterTimeout={9000}
transitionLeaveTimeout={9000}
>
<div className="mdl-layout mdl-js-layout" key={path} ref={node => (this.root = node)}>
<div className="mdl-layout__inner-container">
<Header />
<main className="mdl-layout__content">
<div className={cx(s.content, this.props.className)}>
{children}
</div>
<Footer />
</main>
</div>
</div>
</ReactCSSTransitionGroup>
);
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
prevent react router transitions on parent route when ...
This SwitchCSSTransitionGroup component is detecting if routes inside are really switching (based on react-router.
Read more >Animating React Router v4 with ReactCSSTransitionGroup
Let's start by creating the parent route, or the '/' route which will call main component on which we will render child components....
Read more >How to use animated transition in client-only paths site #3674
I'm trying to add animated transition in my client-only paths site ... That's correct, Gatsby changed how it does route changes since that ......
Read more >Animating Route Transitions with React Router
We're all set to start adding routes. Create a pages folder in the src directory. This is where components that resolves to route...
Read more >Usage with React Router - React Transition Group
You should use CSSTransition for each route and manage their in prop on their own. The main challenge is the exit transition because...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@stinoga Do you mind sharing your solution? I don’t think I understand the change by moving the
<Layout />
component.see https://github.com/kriasoft/react-starter-kit/pull/959