vercel-composition-patterns

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

Updated Jul 30, 2026
One-click install
npx skills add https://github.com/mrestrepoj10/re-hear --skill vercel-composition-patterns-mrestrepoj10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/mrestrepoj10/re-hear/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/mrestrepoj10/re-hear --skill vercel-composition-patterns-mrestrepoj10

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React components accumulate boolean props like isThread, isEditing, and isDMThread as features grow, 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 subcomponents access state without prop drilling. - State Lifting and Dependency Injection: Define generic context interfaces (state, actions, meta) so the same UI works with local state, global stores, or server sync. - React 19 API Guidance: Replace forwardRef with ref-as-prop and useContext with the use() hook. - Use Case: When refactoring a Composer component overloaded with boolean flags, apply these rules to split it into explicit variants like ThreadComposer and EditComposer that share composed internals. ## Quick Start Ask the agent to refactor a React component that has too many boolean props 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 explicit variant components that compose shared internals. Create components like ThreadComposer or EditComposer that each compose the pieces they need from a compound component, eliminating conditional logic and impossible states.

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.Frame, Composer.Input, and Composer.Submit explicitly, accessing shared state via use(ComposerContext).

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