gitmyhub

react-fiber-architecture

★ 13k updated 1y ago

A description of React's new core algorithm, React Fiber

A detailed written guide explaining how React Fiber works internally, covering scheduling, reconciliation, and why React breaks rendering into pauseable chunks for better performance.

JavaScriptsetup: easycomplexity 1/5

This repository is a written document, not a software library. It contains an in-depth explanation of React Fiber, which is a major internal rewrite of how React, the popular JavaScript framework for building user interfaces, does its work under the hood. The author wrote it while studying the actual React codebase and intended it as a resource for other developers trying to understand the design decisions.

React Fiber focuses on one main problem: making React smarter about when and how it performs updates to a page. In the original React, whenever something changed, the framework would work through its entire update process in one go without stopping. This could cause problems for animations and interactive features because the browser might get blocked from drawing smooth frames. Fiber changes this by breaking the rendering work into small chunks that can be paused, resumed, or discarded depending on what is more urgent.

The document explains several core concepts. Reconciliation is the process React uses to figure out what actually changed so it does not have to redraw everything from scratch. Scheduling is about deciding which updates matter most and when to do them, so that something like an animation from a button click gets handled before less time-sensitive background work. The document explains that React uses a pull-based approach, meaning the framework itself decides when to do work rather than running everything immediately as data arrives.

This repository is aimed at developers who want to understand the internals of React deeply enough to contribute to it or to reason carefully about performance in their own applications. The author notes clearly that this is not an official React document and was written from the perspective of someone following along with the open-source implementation.

If you are not a developer, the content here is quite technical and would not be directly useful. If you are a developer curious about how a major JavaScript framework handles performance optimization at its core, this document is a detailed walkthrough of those design choices.

Where it fits