vercel-composition-patterns

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

2|Updated Aug 23, 2019
One-click install
npx skills add https://github.com/alfredosalzillo/alfredosalzillo.github.io --skill vercel-composition-patterns-alfredosalzillo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/alfredosalzillo/alfredosalzillo.github.io/tree/main/.junie/skill/composition-patterns
Command: npx skills add https://github.com/alfredosalzillo/alfredosalzillo.github.io --skill vercel-composition-patterns-alfredosalzillo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Reducing boolean prop proliferation and tangled conditional logic by teaching and applying React composition patterns such as compound components, state lifting, and internal composition to create scalable, maintainable component libraries.

Core Features & Use Cases

  • Guidelines for component architecture, state management, and practical implementation patterns.
  • Techniques for creating explicit component variants and using compound components to avoid prop drilling.
  • Scenarios like building reusable UI libraries, refactoring large codebases, and designing flexible APIs.

Quick Start

Refactor a small UI to use explicit variant components and a shared provider, then compose the UI with the provided primitives.

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 in React by applying composition patterns like compound components, explicit variants, and context providers to separate conditional logic into distinct, reusable primitives.

What's the best way to refactor a React component library to avoid prop drilling?

Refactor a React component library to avoid prop drilling by implementing compound components and context-based state management, allowing parent components to share state implicitly without passing props down manually.

When do I need to use compound components in React?

Use compound components in React when building scalable UI libraries or design systems that require flexible APIs, allowing users to compose complex interfaces from independent, cooperating sub-components.

Does this React composition patterns guidance work with React 19?

Yes, the guidance includes React 19 API directions for applying composition patterns, specifying generic context interfaces and provider-based state management to scale component architecture effectively.

How do I use render props to create explicit component variants?

Create explicit component variants by replacing boolean props with distinct components or render props, passing rendering logic through props to provide flexible composition without tangled conditional logic.

Why does using boolean props make React components hard to maintain?

Boolean props make React components hard to maintain because they cause tangled conditional rendering logic and prop drilling, which composition patterns like explicit variants and shared providers resolve.