vercel-composition-patterns

Refactors React components using compound components, context providers, and composition patterns.

Updated May 14, 2026
One-click install
npx skills add https://github.com/jesusprodriguezUnir/bracketMundial --skill vercel-composition-patterns-jesusprodriguezunir
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/jesusprodriguezUnir/bracketMundial/tree/main/.agents/skills/composition-patterns
Command: npx skills add https://github.com/jesusprodriguezUnir/bracketMundial --skill vercel-composition-patterns-jesusprodriguezunir

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 - Boolean Prop Elimination: Replace prop proliferation with explicit component variants and compound components sharing context. - State Lifting & Dependency Injection: Move state into provider components with generic state/actions/meta context interfaces, decoupling UI from state implementations like useState or Zustand. - React 19 Guidance: Apply modern APIs such as use() instead of useContext() and ref-as-prop instead of forwardRef. - Use Case: When refactoring a message composer with flags like isThread, isEditing, and isForwarding, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing compound internals. ## Quick Start Refactor this React component that uses boolean props into compound components with a shared context provider following the composition patterns 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 explicit component variants that compose shared internals. Create separate components like ThreadComposer or EditComposer, each composing only the pieces it needs from a compound component structure.

What are compound components in React?▼

Compound components are a pattern where a parent component shares state with its subcomponents through context instead of props. Consumers compose pieces like Composer.Input and Composer.Submit explicitly, avoiding hidden conditionals and prop drilling.

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 back to the child, such as rendering list items.

Does React 19 still require forwardRef?▼

No, React 19 makes ref a regular prop, so forwardRef is unnecessary. The use() hook also 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 inside the provider boundary can access state and actions via context even if they are not visually nested inside the main UI.