What problem does it solve?
This Skill addresses the complexity of building and maintaining React components by promoting composition patterns over prop-based conditional logic, leading to more flexible, readable, and scalable codebases.
Core Features & Use Cases
- Avoid Boolean Prop Proliferation: Guides developers to use composition instead of numerous boolean props for component variations.
- Compound Components: Demonstrates structuring complex components with shared context for flexible composition.
- State Management Patterns: Details how to decouple state from UI and lift state into providers for better reusability and testability.
- React 19 API Adoption: Includes guidance on using
use() instead of useContext() and handling refs as regular props.
- Use Case: Refactoring a large, monolithic
Composer component that uses many boolean flags into smaller, composable variants like ThreadComposer, EditComposer, and ForwardComposer.
Quick Start
Apply the vercel-composition-patterns skill to refactor the provided React component to use compound components and avoid boolean prop proliferation.