vercel-composition-patterns

Refactor React components into compound components, render props, and context providers.

Updated Oct 12, 2025
One-click install
npx skills add https://github.com/zomeru/rezumerai --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/rezumerai/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/zomeru/rezumerai --skill vercel-composition-patterns-zomeru

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Boolean prop proliferation in React components leads to combinatorial variants and hard-to-maintain code. This skill introduces composition-based patterns like compound components, render props, context providers, and explicit variant components to create scalable, reusable APIs.

Core Features & Use Cases

  • Use compound components to share state via context without prop drilling.
  • Lift state into providers to enable UI outside the main frame to access actions and state.
  • Create explicit variant components (ThreadComposer, EditMessageComposer, ForwardMessageComposer) for self-documenting code.
  • Adapt to React 19 API changes (use instead of useContext, and regular ref prop).

Quick Start

Create an explicit variant (for example, ThreadComposer) wrapped in its provider and composed inside a Composer.Frame to render the desired pattern.

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 to avoid boolean prop proliferation?

Boolean prop proliferation causes combinatorial variant explosion in React components. Apply composition patterns like compound components, render props, context providers, and explicit variant components to build scalable, maintainable, and reusable UI APIs.

How do compound components share state in React without prop drilling?

Compound components share state in React by using context providers to distribute data and actions to child components. This eliminates prop drilling and allows UI elements outside the main frame to access necessary state directly.

Does React 19 require forwardRef for compound component composition patterns?

React 19 eliminates the need for forwardRef in composition patterns, allowing regular ref props. It also introduces the use() hook to replace useContext for accessing context providers within compound components.

When should I use explicit variant components instead of boolean props in React?

Use explicit variant components instead of boolean props when building reusable UI primitives or refactoring component libraries. Variants like ThreadComposer or EditMessageComposer create self-documenting APIs that prevent combinatorial state explosion.

What is the best way to lift state into providers for React UI components?

Lift state into context providers to share actions and data across React UI components. This composition pattern enables elements outside the main component frame to access state directly, preventing prop drilling and ensuring scalable architecture.

Can I use render props with React 19 context providers?

Yes, render props can be used with React 19 context providers. This composition pattern works alongside the new use() API and regular ref props to create flexible, reusable component APIs without needing forwardRef.