styles • Laying out elements • Painting the actual pixels • Most screens refresh 60 times per second (60fps), • This window represents the time to get a single frame to the screen (Professor Math says 1000 ÷ 60 = ~16ms).
come back to it later. 2. Assign priority to different types of work. 3. reuse previously completed work. 4. abort work if it's no longer needed. In order to do any of this, we first need a way to break work down into units. In one sense, that's what a fiber is. A fiber represents a unit of work.
do this • Interrupt current rendering call stack • "Stash" the call stack off to the side • Perform some higher priority work, which has its own call stack • Go back to the original call stack and resume. This is essentially what React Fiber does. Fiber can switch between limitless number of call stack. It's a reimplementation of the stack, specialized for React components.
virtual stack frame. Information from the stack is preserved in memory on the heap. Hence, they can be manipulated and run whenever they want. Fiber contains information about a component, its input and output.
large updates don't block the main thread - instead, the work is spread out and performed during idle periods using cooperative scheduling. But once you make something async, you introduce the possibility that things may appear on the screen at separate times. How does React solve this?
split into two main phases: • The render phase, where we compare the new tree with the existing tree and calculate the changes that need to be made. This phase is free of side-effects, so it can be done asynchronously. The work can also be interrupted, rebased, restarted, and interleaved with other updates. • the commit phase, where the changes computed during the render phase are flushed to the screen. This phase is typically very fast and is performed synchronously to avoid inconsistencies.