~/alexsh.blog

$ cat react-internals/07-context-internals.md

Context Internals

February 9, 20261 min readpart 07/13

When a Provider re-renders with a new value, React runs propagateContextChange: it walks the subtree, checks each Fiber's dependencies for this context, and marks matches with ForceUpdate — even through memoized ancestors.

Context is all-or-nothing. Any change to the value re-renders every consumer, regardless of which slice they read. There's no built-in selector. This is what libraries like Zustand and Jotai solve.

Further reading