What problem does it solve?
This Skill addresses the complexity of building and maintaining React components, particularly those suffering from prop proliferation and difficult composition. It provides patterns to create more flexible, readable, and scalable component architectures.
Core Features & Use Cases
- Avoid Boolean Prop Proliferation: Guides developers to use composition over excessive boolean props for component variants.
- 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 Updates: Includes guidance on new APIs like
use() and ref handling.
- Use Case: Refactoring a large, monolithic
Modal component with dozens of boolean props into a set of smaller, composable components that can be assembled into different modal types (e.g., confirmation modal, form modal).
Quick Start
Apply the principles of compound components to refactor the Composer component by composing children over render props.