vercel-composition-patterns

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

Updated Apr 1, 2026
One-click install
npx skills add https://github.com/DCueto/zen-track --skill vercel-composition-patterns-dcueto
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/DCueto/zen-track/tree/main/ZenTrackApp/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/DCueto/zen-track --skill vercel-composition-patterns-dcueto

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 replace prop proliferation with compound components, lifted state, and dependency-injected context. ## Core Features & Use Cases - Compound Component Architecture: Structure complex components with shared context so consumers compose exactly the pieces they need. - State Lifting and Dependency Injection: Define generic context interfaces (state, actions, meta) so the same UI works with local state, Zustand, or server-synced providers. - 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 isThread, isEditing, and isForwarding flags, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardMessageComposer variants sharing composed internals. ## Quick Start Ask the AI 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 a React component with too many boolean props?▼

Replace boolean props like isThread or isEditing with explicit variant components that compose shared internals. Each variant, such as ThreadComposer or EditComposer, declares exactly what it renders, eliminating exponential conditional states.

What are compound components in React?▼

Compound components are subcomponents sharing a common context, exported as a group like Composer.Frame, Composer.Input, and Composer.Submit. Consumers compose the pieces they need while subcomponents access shared state via context instead of props.

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 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. The guidance also replaces useContext() with use(), which can additionally be called conditionally. Skip these rules if you are on React 18 or earlier.

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

Lift state into a provider component so any descendant, not just visually nested children, can access state and actions via context. This avoids prop drilling, useEffect syncing, and reading state from refs.