What problem does it solve?
Many React components become hard to maintain due to boolean prop proliferation, tightly coupled state implementations, and monolithic APIs that produce brittle conditional logic and duplicated variants.
Core Features & Use Cases
- Eliminate boolean props: Replace mode flags with explicit variant components to avoid exponential state combinations.
- Compound components & context: Build composable UI pieces that consume a shared context (state, actions, meta) provided by a parent provider.
- Lift and decouple state: Move state into provider boundaries so sibling UI and external controls can read and act on the same data; support swapping implementations without changing UI.
- React 19 guidance: Recommend using use() instead of useContext(), treat ref as a regular prop, and update component patterns for React 19 APIs.
- Use Case: Refactor a chat composer or design a component library where multiple providers (local ephemeral, global synced) must reuse the same input, submit, and meta behaviors while remaining implementation-agnostic.
Quick Start
Refactor the Composer component to remove boolean props by creating a Composer.Provider that injects a generic context (state, actions, meta) and expose explicit variant components like ThreadComposer and EditComposer.