How React decides what actually changed, without diffing every node from scratch.
A fully general tree-diffing algorithm is O(n³) — far too slow to run on every state update. React's reconciliation algorithm gets this down to O(n) by relying on two heuristics that hold true for almost all real UI: elements of different types produce substantially different trees (so React doesn't bother trying to diff a <div> against a <span>, it just replaces it), and keys give React a stable identity hint for items in a list across renders.
Keys are what let React tell 'this item moved' apart from 'this item was deleted and a new one was added' — without them (or with array index used as a key, which reconciliation treats as a fresh key whenever the list reorders), React can end up unnecessarily unmounting and remounting components, or worse, mismatching component state to the wrong list item. Reconciliation itself is a plain algorithm, and Fiber is what changed how it's executed — turning what used to be one uninterruptible synchronous walk into work that can be paused, resumed, or abandoned.
What you'll walk away knowing