vercel-composition-patterns

Apply React composition patterns to reduce boolean props and build scalable component libraries.

5|Updated Sep 17, 2022
One-click install
npx skills add https://github.com/kevinxo328/mercari-scraper --skill vercel-composition-patterns-kevinxo328
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/kevinxo328/mercari-scraper/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/kevinxo328/mercari-scraper --skill vercel-composition-patterns-kevinxo328

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Patterns to avoid boolean prop proliferation and enable scalable, reusable React component libraries by promoting composition, compound components, and context-driven APIs.

Core Features & Use Cases

  • Guidelines for applying explicit component variants, lifting state into providers, and using shared context across UI bits.
  • Examples contrast monolithic components with explicit variant components like ThreadComposer, EditMessageComposer, and ForwardMessageComposer to improve readability and maintainability.
  • Real-world applications include building flexible component libraries, refactoring legacy code, and aligning with React 19 API changes.

Quick Start

Refactor a component to use explicit variants and a compound component structure following this guide.

Frequently Asked Questions about vercel-composition-patterns

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

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

Reduce boolean prop proliferation by applying composition patterns like explicit variants, replacing single monolithic components with separate ones such as ThreadComposer and EditMessageComposer to improve readability and maintainability.

What is the best way to structure a scalable React component library?

Structure scalable React component libraries using compound components, lifting state into context providers, and applying explicit variants to enable reusability and avoid monolithic component architectures.

How does dependency injection via context work in React composition patterns?

Dependency injection via context works by lifting shared state into context providers, allowing compound components to access shared data and functions without prop drilling through every component layer.

Do React composition patterns and compound components work with React 19 APIs?

Yes, React composition patterns and compound components are fully compatible with React 19 APIs, providing guidelines for refactoring legacy code and aligning context-driven architectures with the latest API updates.

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

Use explicit variant components when facing complex boolean prop combinations that hurt readability, whereas render props are better suited for flexible rendering logic without needing entirely separate component structures.