Skip to content
Middle5 views

What does the React pipeline look like after running JSX/code? What happens when state changes?

Practice

AI answer

JSX is usually transformed by a bundler into React calls, and the browser executes the resulting JavaScript. During the initial render, createRoot(...).render(...) causes React to call the components and build an element tree, then reconcile it with the previous tree and create or update the DOM during the commit phase. After that, the browser calculates styles and layout, then renders the page.

When state changes, React schedules an update (often batching several updates together), recalculates the affected components, and compares the new tree with the previous one. Only the necessary changes are applied to the DOM—React does not recreate the entire page. Effects then run: useLayoutEffect before the frame is displayed, and useEffect usually after it. In concurrent mode, React can interrupt and resume work during the render phase; the commit remains atomic.