vercel-composition-patterns

Guides React component refactoring using compound components, context providers, and composition patterns.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill vercel-composition-patterns-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/agents/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill vercel-composition-patterns-ravitejakarra24

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React components often accumulate boolean props like isThread or isEditing that create exponential state combinations and unmaintainable conditional logic. This Skill provides structured composition patterns to refactor such components into flexible, maintainable architectures. ## Core Features & Use Cases - Compound Component Patterns: Replace monolithic components and boolean props with compound components sharing context, so consumers compose exactly the pieces they need. - State Management via Providers: Lift state into provider components with generic state/actions/meta context interfaces, enabling dependency injection and swapping state implementations without changing UI. - React 19 API Guidance: Apply modern React 19 conventions such as ref as a regular prop and use() instead of useContext(). - Use Case: When refactoring a message composer that has grown props like isThread, isEditing, and isDMThread, use this Skill to split it into explicit variants (ThreadComposer, EditComposer) backed by shared compound component internals. ## Quick Start Ask the agent to refactor a React component with many boolean props into compound components using the composition patterns in this skill.

Frequently Asked Questions about vercel-composition-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor React components with too many boolean props?

Replace boolean props with composition by creating explicit variant components like ThreadComposer or EditComposer. Each variant composes shared compound component pieces, eliminating conditional logic and impossible states.

What are compound components in React?

Compound components are a pattern where a parent component and its subcomponents share state through context rather than props. Consumers compose pieces like Composer.Frame, Composer.Input, and Composer.Submit explicitly instead of configuring a monolithic component.

Should I use children or render props for React composition?

Prefer children for composing static structure because they are more readable and compose naturally. Use render props only when the parent needs to pass data or state back to the child, such as rendering list items.

Does React 19 still require forwardRef?

No, in React 19 ref is a regular prop and no forwardRef wrapper is needed. Additionally, use() replaces useContext() and can be called conditionally, unlike useContext.

How do I share state between sibling React components without prop drilling?

Lift state into a provider component that wraps the siblings in a shared context. Components anywhere inside the provider boundary can access state and actions, even if they are not visually nested inside the main UI.