vercel-composition-patterns

Guide React library refactors to replace boolean props with compound components and provider state.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/JuanGarciaFuture/mobile-practice --skill vercel-composition-patterns-juangarciafuture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/JuanGarciaFuture/mobile-practice/tree/main/.cursor/skills/composition-patterns
Command: npx skills add https://github.com/JuanGarciaFuture/mobile-practice --skill vercel-composition-patterns-juangarciafuture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide provides guidance to avoid boolean prop proliferation by promoting composition, compound components, and provider-based state, enabling scalable and maintainable React codebases.

Core Features & Use Cases

  • Avoid Boolean Prop Proliferation: Replace many boolean flags with explicit component variants and composition.
  • Use Compound Components: Build flexible UIs from small, reusable pieces backed by shared context.
  • Lift State into Providers: Centralize state in providers so UI remains decoupled from state management implementations.
  • Explicit Variants: Provide explicit components like ThreadComposer, EditMessageComposer, and ForwardMessageComposer to document behavior clearly.
  • React 19 API Changes: Adopt use() over useContext and treat ref as a regular prop.

Quick Start

Refactor a component library to replace boolean props with explicit variant components and shared context providers.

Frequently Asked Questions about vercel-composition-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I avoid boolean prop proliferation in React components?

Avoid boolean prop proliferation in React by replacing flags with explicit variant components like ThreadComposer and ForwardMessageComposer. This composition approach uses small, reusable pieces backed by shared context to document behavior clearly, ensuring scalable and maintainable codebases.

What is the best way to centralize state in a React component library?

The best way to centralize state in a React component library is by lifting it into context providers. This decouples UI components from state management implementations, allowing flexible compound components to share data without boolean prop drilling.

How do I build compound components in React with shared context?

Build compound components in React by assembling flexible UIs from small, reusable pieces backed by shared context providers. This pattern allows individual parts to communicate implicitly, eliminating the need for complex boolean prop configurations.

Does React 19 replace useContext with a new API for composition patterns?

Yes, React 19 introduces the use() API to replace useContext for composition patterns. When building provider-based state architectures, adopt use() over useContext and treat ref as a regular prop, avoiding forwardRef entirely.

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

Use explicit variant components instead of boolean props when building reusable React libraries or design systems. Providing explicit components like EditMessageComposer documents behavior clearly and prevents sprawling APIs across complex dashboards.