What problem does it solve?
This guide addresses unmaintainable React components caused by boolean prop proliferation, tight coupling of UI to state implementations, and hidden conditional complexity. It helps teams design explicit, composable component APIs and provider-driven state boundaries so components remain reusable and predictable as codebases grow.
Core Features & Use Cases
- Compound Components: Patterns for splitting complex UIs into Provider + subcomponents that share a typed context (state, actions, meta).
- State as Dependency Injection: Define generic context interfaces so the same UI works with local, global, or synced state implementations.
- Explicit Variants & Composition: Replace multi-mode boolean props with explicit variant components (ThreadComposer, EditComposer, ForwardComposer) to document behavior and avoid impossible states.
- React 19 Notes: Guidance for React 19 API changes such as using use() instead of useContext() and treating ref as a regular prop.
- Use Cases: Refactoring legacy components with many toggles, authoring a shared component library, and reviewing architecture during code health sprints.
Quick Start
Use the vercel-composition-patterns guidance to refactor a component that uses multiple boolean props into an explicit provider-backed compound component.