vercel-composition-patterns

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

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/AbuBakar125-co/Resturant_web --skill vercel-composition-patterns-abubakar125-co
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/AbuBakar125-co/Resturant_web/tree/main/agent/skills/vercel-composition-patterns
Command: npx skills add https://github.com/AbuBakar125-co/Resturant_web --skill vercel-composition-patterns-abubakar125-co

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 - Compound Component Patterns: Replace monolithic components and boolean props with compound components sharing context, so consumers compose exactly the pieces they need. - State Management Guidelines: Lift state into provider components and define generic context interfaces (state, actions, meta) for dependency injection across different state implementations. - React 19 API Guidance: Covers React 19 changes including ref as a regular prop and use() replacing useContext(). - Use Case: When refactoring a chat composer component overloaded with isThread, isEditing, and isForwarding flags, apply these rules to split it into explicit ThreadComposer, EditComposer, and ForwardComposer variants sharing a common context interface. ## 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 a React component with too many boolean props?

Replace boolean props with composition by creating explicit variant components like ThreadComposer or EditComposer. Each variant composes shared subcomponents through a common context provider, eliminating conditional logic and impossible states.

What are compound components in React?

Compound components are structured as a parent provider plus subcomponents that share state via context instead of props. Consumers compose only the pieces they need, such as Composer.Frame, Composer.Input, and Composer.Submit.

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 rendering list items.

Does forwardRef still work in React 19?

In React 19, ref is a regular prop, so forwardRef wrappers are unnecessary. 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 so any descendant within the provider boundary can access state and actions via context. Components do not need to be visually nested inside the main UI, only within the provider.