context provider
The component that supplies a context value to everything inside it.
In more detail
In React 19 you render the context itself as the provider, as in <ThemeContext value={theme}>, instead of the older <ThemeContext.Provider>. Providers can be nested, and a nearer provider overrides a farther one for its subtree. Passing a new object literal as value each render re-renders all consumers.
Examples
A compound Tabs root renders <Ctx.Provider value="tab1"> around its children.<ThemeContext value={{ mode }}><Display /></ThemeContext>Related terms
- React Context — A React feature that lets a parent component make a value available to every component below it without passing it as props.
- useContext — The React hook that reads the value of a context from the nearest provider above the component.
- context splitting — Dividing one large context into several smaller ones so components re-render only when the data they actually read changes.
Taught in
- Compound Component Patterns: Context Sharing & Internal State — Design Systems & Component Engineering
- Overlay Architecture: Portals, Stacking Contexts & Backdrops — Design Systems & Component Engineering
- useContext in Depth: Scoping, Consumer Subscription Costs — React 19 & Modern Component Architecture
- Compound Components: Inversion of Control with Context — React 19 & Modern Component Architecture
- React Portals: Escaping Stacking Contexts for Modals — React 19 & Modern Component Architecture