Home / Learn React / How React Renders

How React Renders

To debug state and effects you need to know what a render is. React works in three steps: trigger, render and commit.

In shortA render is React calling your component. A commit is React changing the real DOM. Rendering is pure: same inputs, same output.

Theory in plain words

The render pipeline1. Triggermount or setState2. Rendercall components3. Commitchange the DOM4. EffectsuseEffect runs
The render pipeline

What it is

Rendering is React calling your component functions to find out what should be on the screen. Committing is applying the difference to the real browser DOM.

Why we use it

If you know when a component runs, you know why a log prints twice, why state looks old inside an handler and how to keep your app fast.

How it works

A render is triggered by the first mount or by a state change. React renders (calls components) top down. It compares the result with the previous one and commits only the changes to the DOM. Then the browser paints and effects run.

Where it is used

  • Understanding re-renders and performance
  • Writing correct effects
  • Debugging "why is my state old?"
  • Learning how StrictMode finds bugs

Components must be pure

A pure function gives the same output for the same input and changes nothing outside itself. React components should be pure while they render: do not change outside variables, do not call Math.random() or read Date.now() to build the output, and do not mutate props or state.

Watch the rendersTry it Yourself

Open the console area under the result. When App renders, all its children render too, even if their props did not change.

What triggers a re-render?

React skips a render if you set state to the same value (it compares with Object.is).

Same value, no re-renderTry it Yourself

Virtual DOM in one minute

React keeps a lightweight description of the UI in memory. After each render it compares the new description with the old one (diffing) and updates only the real DOM nodes that changed. You do not manage that. It is why you can "redraw everything" in your code and it stays fast.

StrictMode

In development, <StrictMode> renders every component twice and runs every effect twice on mount, to expose impure code and missing cleanups. It does nothing in the production build. If you see a log twice during development, this is usually why.

Tip:React DevTools (a browser extension) can highlight components when they render. It is the best tool for performance questions.

Quick quiz

1. What are the three steps of rendering?

2. Does a parent re-render re-render its children by default?

3. What does StrictMode do in development?

4. A component must be...

Common questions

What are the three steps of rendering?

Trigger, render, commit. Trigger, render, commit.

Does a parent re-render re-render its children by default?

Yes. Yes, unless you use memo or the child is the same element.

What does StrictMode do in development?

Renders twice and re-runs effects to expose bugs. It helps find impure rendering and missing cleanup.