Page transition rerendering component when _app state changes
See original GitHub issueHello,
I am using this component for transitioning routed component in nextjs.
Problem comes when you change something in state in _app.js
file, which manages applications wrapper, render will fire, which is expected behavior. But along with it, children of <PageTransition>
component will re-render. Now, this will unmount and mount everything inside.
There should be some kind of custom shouldComponentUpdate
implementation that if children don’t change, you don’t re-render them. Since the point of transition is to animate only if children of <PageTransition>
change.
I suppose this can be solved if you replace React.Component with React.PureComponent, i guess that shallow comparison of React will do the job.
Thanks, Mario
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
State change not re-rendering component - Stack Overflow
You can update state from changed props using componentDidUpdate() or shouldComponentUpdate(). componentDidUpdate should be protected with ...
Read more >How do I keep pages from re-rendering completely in Next.js?
if I have a page called a.js, b.js, and c.js. in each file it looks like this. a.js. import Progress from "../components/progress"; import...
Read more >How and when to force a React component to re-render
The component did not change, so there was no re-rendering trigger. Here's why. React evaluates state changes by checking its shallow ...
Read more >React.Component
An update can be caused by changes to props or state. These methods are called in the following order when a component is...
Read more >21 Performance Optimization Techniques for React Apps
React builds and maintains an internal representation of the rendered UI (Virtual DOM). When a component's props or state changes, React ...
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
No worries, glad I could be of some help!
+1, can’t find this in the readme