vercel-composition-patterns

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

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

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, making component codebases easier to maintain and refactor. ## Core Features & Use Cases - Compound Component Patterns: Structure complex components with shared context so consumers compose only the pieces they need. - State Lifting and Dependency Injection: Define generic context interfaces (state, actions, meta) so the same UI works with different state implementations like useState or Zustand. - React 19 API Guidance: Replace forwardRef with ref as a regular prop and use() instead of useContext(). - 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 compound 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 compound internals such as Composer.Frame, Composer.Input, and Composer.Footer, eliminating hidden conditionals and impossible states.

What are compound components in React?▼

Compound components are subcomponents sharing a common context, exported as a group like Composer.Provider, Composer.Input, and Composer.Submit. Consumers compose exactly the pieces they need, and subcomponents access shared state via context instead of 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. Render props remain appropriate when the parent must pass data back to the child, such as a List component providing item and index to renderItem.

Does forwardRef still work in React 19?▼

React 19 makes ref a regular prop, so the forwardRef wrapper is no longer needed. Function components can accept ref directly in their props, and use() replaces useContext() for reading context, including conditional calls.

How do I share React state with components outside the main UI?▼

Lift state into a provider component that wraps the UI tree. Any component inside the provider boundary, even siblings outside the visual component frame, can access state and actions through context without prop drilling, refs, or useEffect syncing.