vercel-composition-patterns

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

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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 - Compound Component Architecture: Structure complex components with shared context so consumers compose exactly the pieces they need without prop drilling. - State Lifting and Dependency Injection: Move state into provider components with generic state/actions/meta interfaces, letting the same UI work with local state, Zustand, or server sync. - React 19 API Guidance: Apply modern patterns like ref-as-prop and use() instead of forwardRef and useContext. - Use Case: When refactoring a Composer component overloaded with boolean flags, use this Skill to split it into explicit variants like ThreadComposer and EditComposer that share compound internals. ## Quick Start Ask the AI to refactor a React component with many boolean props into compound components 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 composition by creating explicit variant components like ThreadComposer or EditComposer. Each variant composes shared compound components such as Composer.Frame, Composer.Input, and Composer.Footer, eliminating hidden conditionals 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 rather than props. Consumers compose pieces like Composer.Input and Composer.Submit explicitly, accessing shared state via use(ComposerContext) without 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. Use render props only when the parent needs to pass data back to the child, such as a List component providing item data to renderItem.

Does forwardRef still work in React 19?▼

In React 19, forwardRef is unnecessary because ref is now a regular prop you can destructure directly in function components. The use() hook also replaces useContext() and can be called conditionally, unlike useContext.

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

Lift state into a provider component that wraps the entire subtree. Any component inside the provider boundary, even siblings outside the main UI like dialog action buttons, can access state and actions through context without prop drilling or refs.