Dev.Lib
arrow_backBack to Blogs
LEVEL_022.1June 27, 20261 min read

Reconciliation algorithm

React & Rendering

React walks trees comparing element types — same type updates props/DOM in place; different type unmounts subtree.

Summary

React walks trees comparing element types — same type updates props/DOM in place; different type unmounts subtree. Keys identify stable identity across siblings; missing/wrong keys cause state bugs and DOM reuse errors. Bailout when props/state unchanged (memo, PureComponent, compiler). Understand what triggers full subtree reconciliation vs bailout.

Code example

// Same element type → update props in place
// Different type → unmount subtree
function List({ items }) {
  return items.map((item) => <Row key={item.id} data={item} />);
}

Key points

  • React walks trees comparing element types — same type updates props/DOM in place; different type unmounts subtree.
  • Keys identify stable identity across siblings; missing/wrong keys cause state bugs and DOM reuse errors.
  • Bailout when props/state unchanged (memo, PureComponent, compiler).
  • Understand what triggers full subtree reconciliation vs bailout.

Further reading

Related concepts