SlideShare a Scribd company logo
Understanding of React Fiber Architecture
React v16.0 was released with an update to react core algorithm. This new core architecture is
named “Fiber”. Facebook has completely rewritten the internals of React from the ground-up
while keeping the public API essentially unchanged, in simple terms it means only changing the
engine of a running car. With this release, some new features are also added like Asynchronous
Rendering, Portals, Error Boundaries, Fragments (i.e. return array of elements). Incremental
rendering is the headline addition to React which adds the ability to split rendering work into
chunks.
React Fiber is the new reconciliation algorithm. Reconciliation is the process of comparing or
diffing old trees with a new tree in order to find what is changed or modified. In the original
reconciliation algorithm (now called Stack Reconciler) the processing of component tree was
done synchronously in a single pass, so the Main Thread was not available for other UI related
tasks like animation, layouts, and gestures handling. Fiber Reconciler has different goals:
• Ability to split interruptible work in chunks.
• Ability to prioritize, rebase and reuse work in progress.
• Ability to yield back and forth between parents and children to support layout in React.
• Ability to return multiple elements from render().
Fig: Stack Reconciler (synchronous rendering)
Fig: Fiber Reconciler (asynchronous rendering)
Sierpinski triangle rendering using Stack and Fiber:
• Fiber Example
• Stack Example
In the above example, there are 2 different kinds of updates going on. One that makes the
triangle narrow and wide which has to happen every 16ms (60 FPS) in order for the animation to
look smooth and one that updates the numbers contained inside every single dot which happens
approximately every 1000ms.
A fiber (not Fiber with a capital ‘F’) is a javascript object that contains information about a
component, its input, and output. At any time, a component instance has at most two fibers that
correspond to it: the current fiber and the work-in-progress fiber. Fiber can be defined as a unit of
work.
Fiber prioritizes work on 7 levels:
1. NoWork – no work is pending.
2. SynchronousPriority – for controlled text inputs. Synchronous side-effects.
3. TaskPriority – completes at the end of the current tick.
4. AnimationPriority – needs to complete before the next frame.
5. HighPriority – an interaction that needs to complete pretty soon to feel responsive.
6. low priority – data fetching, or result from updating stores.
7. OffscreenPriority – Won’t be visible but do the work in case it becomes visible.
React Fiber performs reconciliation in two phases: Render and Commit
1. Lifecycle methods called during render phase:
• UNSAFE_componentWillMount()
• UNSAFE_componentWillReceiveProps()
• getDerivedStateFromProps()
• shouldComponentUpdate()
• UNSAFE_componentWillUpdate()
• render()
2. Lifecycle methods called during commit phase:
• getSnapshotBeforeUpdate()
• componentDidMount()
• componentDidUpdate()
• componentWillUnmount()
Earlier whole reconciliation process was synchronous (recursive) but in Fiber it is divided in two
phases. Render phase (a.k.a. Reconciliation phase) is asynchronous and due this reason three
of the lifecycle methods were marked unsafe because putting the code with side-effects inside
these methods can cause problems as lifecycle methods of different components are not
guaranteed to fire in predictable order.
Fig: Triangle update timeline (Image Source: Giamir Blog)
Fig: Triangle update timeline using Stack (Image Source: Giamir Blog)
Fig: Triangle update timeline using Fiber (Image Source: Giamir Blog)
React Fiber uses requestIdleCallback() to schedule the low priority work and
requestAnimationFrame() to schedule high priority work.
Problems with Current Implementation:
• Long-running tasks cause frame drops.
• Different tasks have different priorities.
So in a nutshell, what makes Fiber interesting?
• It makes apps more fluid and responsible.
• In the future, it could parallelize work a.k.a. Time Slicing.
• It would improve startup time while rendering components using React Suspense.
Fiber is currently available for use but it runs in compatibility mode with the current
implementation.
InnovationM is a globally renowned mobile app development company in Noida that caters to a
robust & secure Android app development, iOS app development, hybrid app development
services. Our commitment & engagement towards our target gives us brighter in the world of
technology and has led us to establish success stories consecutively. InnovationM is the
top Android app development company in Noida.
Thanks for giving your valuable time. Keep reading and keep learning.
InnovationM Technology Solutions
A-36, Sector-4 Noida 201310
Sales@innovationm.com
https://www.innovationm.com/
+91 7838065578

More Related Content

PPTX
Massif - the love child of Matlab Simulink and Eclipse
PDF
The Three Horse Race
PPTX
Web Performance & Latest in React
PPTX
Session 03_04-Working with React Native.pptx
PDF
React Conf 17 Recap
PDF
Concurrency and parallel in .net
PPTX
Better web apps with React and Redux
PPTX
Reactive programming with rx java
Massif - the love child of Matlab Simulink and Eclipse
The Three Horse Race
Web Performance & Latest in React
Session 03_04-Working with React Native.pptx
React Conf 17 Recap
Concurrency and parallel in .net
Better web apps with React and Redux
Reactive programming with rx java

Similar to Understanding of react fiber architecture (20)

PDF
JOSA TechTalks - Better Web Apps with React and Redux
PPTX
Reactive Programming on Android - RxAndroid - RxJava
PDF
What is React Concurrent Mode: A Walkthrough
PPTX
React Native’s New Architecture Decoded: How to Migrate & Benefits?
PDF
Welcome to React & Flux !
PPTX
Js engine performance
PPT
ActionEmbedding
PPTX
ReactJs Training in Hyderabad | ReactJS Training
PPTX
How To Upgrade The React 18 Release Candidate.pptx
PPTX
React Fiber
PPTX
Introduction to ReactJS UI Web Dev .pptx
PDF
Basic React Knowledge.
PDF
Adopting Grails - GR8Conf Europe
PDF
GR8Conf 2011: Adopting Grails
PDF
PPTX
Basic React Knowledge.
PPTX
React-JS.pptx
PDF
React 18: New Features & Innovations
PDF
Real Time Sign Language Recognition Using Deep Learning
PPT
Java2 platform
JOSA TechTalks - Better Web Apps with React and Redux
Reactive Programming on Android - RxAndroid - RxJava
What is React Concurrent Mode: A Walkthrough
React Native’s New Architecture Decoded: How to Migrate & Benefits?
Welcome to React & Flux !
Js engine performance
ActionEmbedding
ReactJs Training in Hyderabad | ReactJS Training
How To Upgrade The React 18 Release Candidate.pptx
React Fiber
Introduction to ReactJS UI Web Dev .pptx
Basic React Knowledge.
Adopting Grails - GR8Conf Europe
GR8Conf 2011: Adopting Grails
Basic React Knowledge.
React-JS.pptx
React 18: New Features & Innovations
Real Time Sign Language Recognition Using Deep Learning
Java2 platform
Ad

More from InnovationM (20)

PDF
How to use data binding in android
PDF
Capture image on eye blink
PDF
Mob x in react
PDF
How to use geolocation in react native apps
PDF
Android 8 behavior changes
PDF
Automatic reference counting (arc) and memory management in swift
PDF
Firebase crashlytics integration in iOS swift (dSYM File Required Problem Res...
PDF
How prototype works in java script?
PDF
React – Let’s “Hook” up
PDF
Razorpay Payment Gateway Integration In iOS Swift
PDF
Paytm integration in swift
PDF
Line Messaging API Integration with Spring-Boot
PDF
Basic fundamental of ReactJS
PDF
Basic Fundamental of Redux
PDF
Integration of Highcharts with React ( JavaScript library )
PDF
Serialization & De-serialization in Java
PDF
Concept of Stream API Java 1.8
PDF
How to Make Each Round of Testing Count?
PDF
Model View Presenter For Android
PDF
Retrofit Library In Android
How to use data binding in android
Capture image on eye blink
Mob x in react
How to use geolocation in react native apps
Android 8 behavior changes
Automatic reference counting (arc) and memory management in swift
Firebase crashlytics integration in iOS swift (dSYM File Required Problem Res...
How prototype works in java script?
React – Let’s “Hook” up
Razorpay Payment Gateway Integration In iOS Swift
Paytm integration in swift
Line Messaging API Integration with Spring-Boot
Basic fundamental of ReactJS
Basic Fundamental of Redux
Integration of Highcharts with React ( JavaScript library )
Serialization & De-serialization in Java
Concept of Stream API Java 1.8
How to Make Each Round of Testing Count?
Model View Presenter For Android
Retrofit Library In Android
Ad

Recently uploaded (20)

PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Approach and Philosophy of On baking technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
cuic standard and advanced reporting.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Weekly Chronicles - August'25-Week II
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Review of recent advances in non-invasive hemoglobin estimation
Dropbox Q2 2025 Financial Results & Investor Presentation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
20250228 LYD VKU AI Blended-Learning.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
A Presentation on Artificial Intelligence
Assigned Numbers - 2025 - Bluetooth® Document
Approach and Philosophy of On baking technology
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
cuic standard and advanced reporting.pdf

Understanding of react fiber architecture

  • 1. Understanding of React Fiber Architecture React v16.0 was released with an update to react core algorithm. This new core architecture is named “Fiber”. Facebook has completely rewritten the internals of React from the ground-up while keeping the public API essentially unchanged, in simple terms it means only changing the engine of a running car. With this release, some new features are also added like Asynchronous Rendering, Portals, Error Boundaries, Fragments (i.e. return array of elements). Incremental rendering is the headline addition to React which adds the ability to split rendering work into chunks. React Fiber is the new reconciliation algorithm. Reconciliation is the process of comparing or diffing old trees with a new tree in order to find what is changed or modified. In the original reconciliation algorithm (now called Stack Reconciler) the processing of component tree was done synchronously in a single pass, so the Main Thread was not available for other UI related tasks like animation, layouts, and gestures handling. Fiber Reconciler has different goals: • Ability to split interruptible work in chunks. • Ability to prioritize, rebase and reuse work in progress. • Ability to yield back and forth between parents and children to support layout in React. • Ability to return multiple elements from render(). Fig: Stack Reconciler (synchronous rendering) Fig: Fiber Reconciler (asynchronous rendering) Sierpinski triangle rendering using Stack and Fiber: • Fiber Example • Stack Example
  • 2. In the above example, there are 2 different kinds of updates going on. One that makes the triangle narrow and wide which has to happen every 16ms (60 FPS) in order for the animation to look smooth and one that updates the numbers contained inside every single dot which happens approximately every 1000ms. A fiber (not Fiber with a capital ‘F’) is a javascript object that contains information about a component, its input, and output. At any time, a component instance has at most two fibers that correspond to it: the current fiber and the work-in-progress fiber. Fiber can be defined as a unit of work. Fiber prioritizes work on 7 levels: 1. NoWork – no work is pending. 2. SynchronousPriority – for controlled text inputs. Synchronous side-effects. 3. TaskPriority – completes at the end of the current tick. 4. AnimationPriority – needs to complete before the next frame. 5. HighPriority – an interaction that needs to complete pretty soon to feel responsive. 6. low priority – data fetching, or result from updating stores. 7. OffscreenPriority – Won’t be visible but do the work in case it becomes visible. React Fiber performs reconciliation in two phases: Render and Commit 1. Lifecycle methods called during render phase: • UNSAFE_componentWillMount() • UNSAFE_componentWillReceiveProps() • getDerivedStateFromProps() • shouldComponentUpdate() • UNSAFE_componentWillUpdate() • render() 2. Lifecycle methods called during commit phase: • getSnapshotBeforeUpdate() • componentDidMount() • componentDidUpdate() • componentWillUnmount() Earlier whole reconciliation process was synchronous (recursive) but in Fiber it is divided in two phases. Render phase (a.k.a. Reconciliation phase) is asynchronous and due this reason three of the lifecycle methods were marked unsafe because putting the code with side-effects inside these methods can cause problems as lifecycle methods of different components are not guaranteed to fire in predictable order. Fig: Triangle update timeline (Image Source: Giamir Blog)
  • 3. Fig: Triangle update timeline using Stack (Image Source: Giamir Blog) Fig: Triangle update timeline using Fiber (Image Source: Giamir Blog) React Fiber uses requestIdleCallback() to schedule the low priority work and requestAnimationFrame() to schedule high priority work. Problems with Current Implementation: • Long-running tasks cause frame drops. • Different tasks have different priorities. So in a nutshell, what makes Fiber interesting? • It makes apps more fluid and responsible. • In the future, it could parallelize work a.k.a. Time Slicing. • It would improve startup time while rendering components using React Suspense. Fiber is currently available for use but it runs in compatibility mode with the current implementation. InnovationM is a globally renowned mobile app development company in Noida that caters to a robust & secure Android app development, iOS app development, hybrid app development services. Our commitment & engagement towards our target gives us brighter in the world of technology and has led us to establish success stories consecutively. InnovationM is the top Android app development company in Noida. Thanks for giving your valuable time. Keep reading and keep learning.
  • 4. InnovationM Technology Solutions A-36, Sector-4 Noida 201310 Sales@innovationm.com https://www.innovationm.com/ +91 7838065578