r/reactjs • u/ErEr2000 • Jun 17 '26
Resource Re-Rendering
Hey guys,
I want to learn more about how rendering and re rendering in React.js works. Like when a component will be re-rendered, when will it not be re-rendered, what causes Re-Rendering and how to stop it etc.
Can you share any YouTube links or any documentation.
Will really appreciate the community a lot :)
1
Upvotes
10
u/AcanthisittaNo5807 Jun 17 '26
I found Nadia makarevich’s book “advanced react” very helpful on this topic
7
u/louisstephens Jun 17 '26
I dont have any links to videos about this unfortunately. However, the official react docs are an excellent source of information. They have one on Render & Commit.
1
u/ErEr2000 Jun 17 '26
Looking for detailed guide / video if possible
5
u/EvilPete Jun 17 '26 edited Jun 17 '26
A component renders once on ititial render, then re-renders when its props or state changes or a parent re-renders.
However, since React only actually writes to the DOM when the render resulted in different HTML, it is usually fine to re-render a lot. As long as the render function does not contain expensive calculations.
If you use the react compiler, this will be further optimized by automatically memoizing render functions.
3
u/acemarke Jun 17 '26
/u/azangru linked my conference talk on React rendering, but here's the blog post version:
also see my recent talk on the React Compiler as well:
2
u/azangru Jun 17 '26
A guide to react rendering behavior by Mark Erikson, perhaps? Available both as a talk and as a blog post
2
u/MajesticWillow Jun 17 '26
I enjoyed this explanation, it has some textual explanation + visual's
https://alexsidorenko.com/blog/react-render-always-rerenders
On the bottom it continues to other blog post with same way of explanations of other methods in react with props/context/memo/callbacks
https://alexsidorenko.com/blog
1
u/aragost Jun 17 '26
This is my periodic reminder that you can find some very good articles explaining how that works (already linked in the thread), some terrible articles with confused ideas about rendering (context and children are especially tricky, it seems), but for some reason known only to deities React dev tools make it nearly impossible to understand why a component rerendered, so if you have a re rendering issue in a complex app, tough luck
1
u/No_Record_60 Jun 18 '26
Rerender happens when
- parent rerender and you don't memoize the child
- state update
- context update
1
u/davidblacksheep Jun 23 '26
https://blacksheepcode.com/posts/nuance_of_react_rendering_behaviour
-1
u/Conscious-Process155 Jun 17 '26
It will be rendered when it's rendered. It will not be rendered, when it's not rendered. It will re-render, when it re-renders.
-1
u/ErEr2000 Jun 17 '26
! a
-2
u/SamerGoda Jun 17 '26
You can ask Chatgpt to get more details and info to understanding the topics and ask him to go deep