๐—ฅ๐—ฒ๐—ฎ๐—ฐ๐˜ ๐—™๐—ถ๐—ฏ๐—ฒ๐—ฟ ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ ๐—˜๐˜…๐—ฝ๐—น๐—ฎ๐—ถ๐—ป๐—ฒ๐—ฑ

React uses Fiber to render your UI. Most developers use it without knowing how it works.

The old Stack Reconciler worked differently. It walked the entire component tree in one go. You could not stop it. A slow render blocked the main thread. This stopped typing, clicking, and scrolling.

Fiber changes this. It breaks rendering into small units of work. Each unit is one fiber. A fiber is a JavaScript object. It uses pointers to link children, siblings, and parents. This structure allows React to pause mid-render.

React uses two phases:

  1. Render phase React runs component functions and compares old data with new data. This phase is invisible to the user. React pauses, restarts, or throws away work during this phase.

  2. Commit phase React writes changes to the DOM. This phase is synchronous. Users only see a finished UI.

This split explains three common React behaviors:

React also uses lanes to manage priority:

High priority lanes always run first. This is why useTransition works.

React maintains two trees at all times. One tree is on the screen. The other is a work-in-progress tree built off-screen. React swaps them during the commit phase. You never see a half-finished UI.

Read the full breakdown here: https://dev.to/dev_encyclopedia/react-fiber-architecture-explained-how-react-renders-ui-4687