vercel-composition-patterns

Refactor React components with boolean props into compound components and explicit variants.

Updated Feb 24, 2026
One-click install
npx skills add https://github.com/FrekiManagarm/dunlo --skill vercel-composition-patterns-frekimanagarm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/FrekiManagarm/dunlo/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/FrekiManagarm/dunlo --skill vercel-composition-patterns-frekimanagarm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents fragile, unmaintainable React APIs caused by boolean prop proliferation and tangled state management, by guiding teams to use compound components, lifted state, and explicit composition instead.

Core Features & Use Cases

  • Eliminates boolean prop proliferation: Replaces isX/mode-flag props with explicit component variants so only valid combinations render.
  • Builds compound components with injected context: Uses a provider-driven state/actions/meta interface so subcomponents access shared state without prop drilling.
  • Lifts state to enable cross-boundary UI: Moves form state into provider components so sibling components (previews, buttons, dialogs) can read and trigger actions.
  • Improves composition readability: Recommends composing with children over renderX props and prefers explicit variants for clarity.
  • Updates React 19 usage: Covers React 19+ patterns such as using use() instead of useContext() and treating ref as a regular prop.

Quick Start

Ask an AI assistant to refactor your React component by replacing boolean props with explicit variants and implementing a compound component that uses a context provider with injected state, actions, and meta.

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?

Eliminate boolean prop proliferation by replacing isX or mode-flag props with explicit component variants and compound components, ensuring only valid combinations render while improving API maintainability.

What is the best way to share state across nested React components without prop drilling?

Lift state into context provider boundaries and expose a generic interface of state, actions, and meta so nested and sibling components can share data without prop drilling.

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

Compose compound components using children over renderX props and wrap them in a context provider that injects state, actions, and meta so subcomponents access shared data without explicit prop passing.

Does this React refactoring approach support React 19 patterns?

Yes, this refactoring approach aligns with React 19 by utilizing the use() hook for context consumption instead of useContext() and treating ref as a regular prop for cleaner component architecture.

When should I use explicit variants instead of render props in React UI libraries?

Use explicit variants instead of renderX props when designing UI libraries to improve composition readability, preventing fragile APIs by ensuring subcomponents only render valid configuration combinations.