Particles re-renders on every state change even when it is separate from all the state changes.
See original GitHub issueI wrapper all the components that have state changes into a wrapper but the Particles component still gets re-rendered on changes.
render() {
const { isSignedIn, imageUrl, route, box, user } = this.state;
return (
<div className="App">
<Particles className='particles' params={particlesOptions} />
<ComponentsWrapper
isSignedIn={isSignedIn}
imageUrl={imageUrl}
route={route}
box={box}
user={user}
loadUser={this.loadUser}
onInputChange={this.onInputChange}
onImageSubmit={this.onImageSubmit}
onRouteChange={this.onRouteChange}
/>
</div>
);
}
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (3 by maintainers)
Top Results From Across the Web
Particles re-renders on every state change even when it is ...
I see. It is because the Wrapper component is the parent component and that component's state got changed, hence triggering the re-rendering.
Read more >Does React re-render all components when any state ...
Essentially I have a context provider component wrapping many children components. Since I did this I'm having trouble with re-renders. More ...
Read more >React re-renders guide: everything, all at once - Developer way
State changes are the “root” source of all re-renders. ... will re-render, even if they don't use the changed portion of the data...
Read more >When does React re-render components? - Felix Gerschau
Changing the state means that React triggers an update when we call the setState function (in React hooks, you would use useState )....
Read more >Why React Re-Renders - Josh W Comeau
I know some developers believe that every state change in React forces an application-wide render, but this isn't true. Re-renders only affect ...
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 Free
Top 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
I figured it out. Had to separate the components with state changes into a separate component. Thanks for your time!
Oh that’s an interesting use case.
I haven’t really tried it yet because there are other features I’m trying to roll out atm, but I’ll definitely try by tomorrow and contact you if I run into any road blocks. Thanks again for your help!