vercel-composition-patterns

Refactor React components using compound components, lifted state, and context providers.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? React components accumulate boolean props like isThread or isEditing that create exponential state combinations and unmaintainable conditional logic. This Skill provides composition patterns that 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, global stores, or server sync. - 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 create explicit variants like ThreadComposer and EditComposer that share internals without hidden conditionals. ## Quick Start Ask the agent to refactor a React component with many boolean props into compound components 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 component pieces, eliminating conditional logic and impossible 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 exactly 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 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.

Does forwardRef still work in React 19?

In React 19, ref is a regular prop so forwardRef is unnecessary. Accept ref directly in the component signature, and use the use() hook instead of useContext() for reading context.

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 main component frame, can access state and actions through context without prop drilling or refs.