vercel-composition-patterns

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

1|Updated Apr 26, 2026
One-click install
npx skills add https://github.com/CarlosPavajeau/light --skill vercel-composition-patterns-carlospavajeau
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/CarlosPavajeau/light/tree/main/.claude/skills/vercel-composition-patterns
Command: npx skills add https://github.com/CarlosPavajeau/light --skill vercel-composition-patterns-carlospavajeau

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React components often accumulate boolean props like isThread or isEditing, creating exponential state combinations and unmaintainable conditional logic. This Skill provides structured rules for replacing prop proliferation with composition patterns. ## Core Features & Use Cases - Compound Component Architecture: Structure complex components with shared context so consumers compose only the pieces they need. - State Lifting and Dependency Injection: Move state into provider components with generic state/actions/meta interfaces, letting the same UI work with different state implementations. - React 19 API Guidance: Apply modern patterns like ref-as-prop and use() instead of forwardRef and useContext. - Use Case: When refactoring a messaging composer that has grown to handle threads, edits, and forwards via boolean flags, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardComposer variants sharing composed internals. ## Quick Start Ask the AI to refactor a React component that has too many boolean props using these composition patterns.

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 subcomponents through a common context instead of passing conditional flags to one monolithic component.

What are compound components in React?

Compound components are a pattern where a parent component shares state via context with its subcomponents, such as Composer.Frame, Composer.Input, and Composer.Submit. Consumers compose exactly the pieces they need without prop drilling or hidden conditionals.

When should I use children instead of render props in React?

Use children when composing static structure because they are more readable and compose naturally. Reserve render props for cases where the parent must pass data back to the child, such as rendering list items with per-item data.

Does React 19 still require forwardRef?

No, React 19 makes ref a regular prop, so forwardRef is no longer needed. The use() hook also replaces useContext() and can be called conditionally, unlike useContext.

How do I share React state between components that are not visually nested?

Lift state into a provider component that wraps the shared subtree. Any component inside the provider boundary can access state and actions via context, even if it sits outside the main component's visual structure.