Replies: 3 comments 7 replies
-
Hello! It's really only two phases: render -> commit. Here's a diagram I made of when what is called: Setting state kicks things off:
|
Beta Was this translation helpful? Give feedback.
-
To go along with what @rachelnabors wrote, I tried to describe React's current behavior in my post A (Mostly) Complete Guide to React Rendering Behavior. It has sections that describe what "rendering" is (asking a component to return elements to describe the desired UI), and a brief description of the "render" and "commit" phases. |
Beta Was this translation helpful? Give feedback.
-
It should be pointed out that function components don't really have "lifecycles," and "render and commit phases" are more useful to think about when you can perform operations (don't change state during render phase! Render must be pure!). Commit phase is all DOM and effects. A component can have many render phases and never be committed. So thinking of these phases as part of a "lifecycle" isn't quite right ;) It's more like a structure for thinking about how React calculates and updates UI |
Beta Was this translation helpful? Give feedback.
-
As far as I understand there are 3 internal phases in React and here is my rough understanding of what happens in each phase👇🏻
Would love to know from the core team about the internal phases and how React calculates and updates UI!
Beta Was this translation helpful? Give feedback.
All reactions