vercel-composition-patterns

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

4|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/lord007tn/sdm-clickhouse --skill vercel-composition-patterns-lord007tn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/lord007tn/sdm-clickhouse/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/lord007tn/sdm-clickhouse --skill vercel-composition-patterns-lord007tn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Boolean-prop proliferation and rigid component APIs hinder scalable UI development. This Skill showcases React composition patterns that enable building flexible component libraries through compound components, lifting state, and context providers.

Core Features & Use Cases

  • Explicit variants over boolean props to make code self-documenting (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer).
  • Shared-state patterns via providers and context to avoid prop drilling.
  • Guidance on React 19 API usage, including the use() hook in place of useContext and avoiding forwardRef where not needed.

Quick Start

Start by implementing explicit variant components (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer) that compose the shared UI with a provider.

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 stop using boolean props for variants?

To stop using boolean props, refactor React components into explicit variant components like ThreadComposer or EditMessageComposer that compose shared UI with a provider. This promotes scalable composition and makes code self-documenting.

What is the best way to avoid prop drilling in React component libraries?

The best way to avoid prop drilling in React component libraries is by lifting shared state into context providers. This pattern enables flexible APIs and allows compound components to access shared data without passing props through every layer.

Does this React composition approach use the React 19 use() hook instead of useContext?

Yes, this React composition approach adopts React 19 practices by using the use() hook in place of useContext. It also advises avoiding forwardRef where it is not needed to design flexible component APIs.

When should I use compound components in React?

Use compound components in React when building reusable component libraries that require flexible APIs. They solve rigid component structures by allowing you to compose shared UI elements and manage variants explicitly across UI systems.

What are the limitations of using boolean props in React components?

Boolean props cause rigid component APIs and hinder scalable UI development due to boolean-prop proliferation. They make code less self-documenting and harder to maintain compared to explicit variant components and composition patterns.