Menu

Post image 1
Post image 2
Post image 3
Post image 4
Post image 5
1 / 5
0

How React Works (Part 2)? Why React Had to Build Its Own Execution Engine

DEV Community·Sam Abaasi·about 1 month ago
#qTsFQrCb
#react#javascript#scheduler#fiber#stack#work
Reading 0:00
15s threshold

Why React Had to Build Its Own Execution Engine Series: How React Works Under the Hood Part 1: Motivation Behind React Fiber: Time Slicing & Suspense Prerequisites: Read Part 1 first — this article picks up exactly where it left off. Where We Left Off In Part 1 we landed on one sentence that explains why React had to be completely rewritten: React needs to be able to interrupt what it's doing and resume it later. Time Slicing needs it — to yield within the browser's 16ms frame budget. Suspense needs it — to pause and wait for async data. Simple enough requirement. But here's the problem: JavaScript itself won't let you do it. This article is about why that's true, what React did about it, and why that decision — building an entirely custom execution model — is what makes modern React possible. The Problem: JavaScript Runs to Completion When JavaScript starts executing a function, it finishes it.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More