Loading...
Loading...
React Fiber is a new reconciliation mechanism in React 16 that rethinks the rendering and update process. Its main goal is to make virtual DOM rendering incremental: break it into small "tasks", manage priorities and increase interface responsiveness even with large volumes of work.
React uses Virtual DOM to efficiently make changes to real DOM. This is implemented using Fiber, which describes component structure and tracks their changes.
Update initiation
setState, useState) enters update queue (Update Queue).setState calls in one event.Work In Progress tree creation
render methods for class components), resulting in React getting new UI representation.Diffing
Working with keys (key)
key) help match original and new nodes, avoiding complete rebuild.Side effects collection
Priority consideration (Fiber)
Important: In Render Phase real DOM changes aren't yet applied.
componentDidMount, componentDidUpdate, componentWillUnmount.useEffect, useLayoutEffect.Fiber is the foundation of Concurrent Mode, which provides more flexible render control mechanisms. In this mode React can partially show updated interface without blocking rest of application.
Consider perf features:
If parent component renders, by default its child components also re-render. Use React.memo (or PureComponent in class components) if you want to optimize this behavior.