vercel-composition-patterns

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

Updated Aug 15, 2025
One-click install
npx skills add https://github.com/yehezkieldio/topaz --skill vercel-composition-patterns-yehezkieldio
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/yehezkieldio/topaz/tree/main/v3-tether/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/yehezkieldio/topaz --skill vercel-composition-patterns-yehezkieldio

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 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 Management Patterns: Lift state into provider components with generic state/actions/meta context interfaces for dependency injection. - React 19 Guidance: Covers modern APIs including ref as a regular prop and use() replacing useContext(). - Use Case: When refactoring a Composer component with six boolean flags, apply these patterns to split it into ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing compound internals. ## Quick Start Ask the AI to refactor a React component with many boolean props using compound components and lifted state providers.

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 variant components that compose shared internals. Create separate components like ThreadComposer or EditComposer, each composing the exact pieces it needs from a compound component structure instead of passing conditional flags.

What are compound components in React?▼

Compound components are structured as a parent provider with subcomponents that access shared state via context rather than props. Consumers compose exactly the pieces they need, such as Composer.Frame, Composer.Input, and Composer.Submit, without hidden conditionals.

Should I use children or render props for React composition?▼

Prefer children for composing static structure since 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 with per-item data.

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. Components inside the provider boundary access state and actions through context, even when they are not visually nested inside the main component UI.