Making React Context Cheap with React Compiler

Published: 04 October 2026

When building React apps, many of us have probably craved a context selector at some point. Imagine a radio group where each radio needs to know if it is checked. When the selection moves from one radio to another, only those two radios need to render, but using React context means all context consumers render when any value on the context updates.

A context selector would let a component derive a value from context and render only when that value changes. For example:

const checked = useContextSelector(
  RadioContext,
  (context) => context.value === value,
);

But React still doesn't have an API like useContextSelector, even though re-rendering, say, 5,000 radios is generally understood to be expensive. Why?