Is React Fiber part of React's core or a separate thing?

96 views Asked by At

I am extremely confused after having read the following from the old React docs on React Core:

React core only includes the APIs necessary to define components. It does not include the reconciliation algorithm or any platform-specific code. It is used both by React DOM and React Native components.

It clearly says that React core does NOT include the reconciliation algorithm.

But all over the internet people claim that Fiber, which is a reconciler, is a "rewrite of React's core". These two are contradictory statements. I would like to get clarity in this regard as to what exactly is Fiber. (Yes I know all about its features, so please don't go into the features, I just want to know where does it sit in the equation.)

And moreover, is React Fiber also used by, or maybe available in, React Native? Because out there I can't seem to understand this.

1

There are 1 answers

0
E McGill On

The above comment seems right on track that the react-reconciler is shared across DOM/Native renders.

The legacy React docs are pretty straightforward in that React Core refers to only those exposed APIs that are necessary for defining components.

It's off the mark to say that React Fiber is a rewrite of the core because the React fiber architecture is not for defining components.

React’s fiber architecture, which includes the reconciliation diffing algorithm, is how React internally keeps track of the Virtual DOM and the new changes to be reflected in the DOM. Fiber refers to what’s happening under the hood of React, not what’s exposed to developers when defining components.

The “rewrite” that people keep referring to was the move from a stack based reconciler that used recursion to the new, optimized algorithm. Now learning how the two algorithms differ is where I’m at in my investigation.