> front-end

Fibers

Created by: Kitman Yiu

Updated at: 1 day ago

  • Definition: A Fiber is an instance of a component in React, representing a unit of work in the UI.
  • Benefits: React initial rendering process, before Fibers, was based on a recursive call stack, which had limitations in handling intensive UI updates and animations.
  • Keywords: Instance of a component in React, handle complex UIs and improve performance for applications with heavy rendering tasks.

What is Fibers?

A Fiber is an instance of a component in React, representing a unit of work in the UI. Fibers restructure the rendering process into a linked list, optimizing resource allocation and rendering performance.

Origin and Purpose

  • Background: React's initial rendering process, before Fibers, was based on a recursive call stack, which had limitations in handling intensive UI updates and animations.
  • Why Fibers?: Introduced to enhance React's ability to handle complex UIs and improve performance for applications with heavy rendering tasks.

Key Features and Principles

  1. Incremental Rendering: Fibers allow React to split rendering work into chunks and spread it out over multiple frames.
  2. Prioritization of Tasks: Enables prioritizing updates based on importance, improving responsiveness.
  3. Concurrency: Allows pausing, resuming, or aborting rendering tasks, enhancing efficiency.

Impact and Use

Fibers contribute to smoother, more responsive user interfaces and maintain a familiar API for React developers.

Future Directions

Lays the foundation for future improvements in React, like Concurrent Mode, further enhancing rendering and update handling.