vercel-composition-patterns

Convert boolean-prop React components into compound components with provider-based state.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Norfolk-Group/H-Analytics --skill vercel-composition-patterns-norfolk-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/Norfolk-Group/H-Analytics/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/Norfolk-Group/H-Analytics --skill vercel-composition-patterns-norfolk-group

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Many React components become fragile and hard to maintain when feature toggles are implemented as multiple boolean props, producing exponential conditional logic, duplicated implementations, and tightly coupled state. This Skill provides a structured approach to replace boolean-prop-driven conditionals with compound components, provider-based state, and explicit variant components to simplify reasoning, enable reuse, and reduce bugs.

Core Features & Use Cases

  • Compound Components: Design components as composable pieces that share a single context to avoid prop drilling.
  • Provider-Based State & Dependency Injection: Lift state into providers exposing a generic state/actions/meta interface so different providers can power the same UI.
  • Explicit Variants & Children Composition: Replace boolean modes with explicit variant components and prefer composing children over render props for clarity.
  • React 19 API Guidance: Migrate ref handling and context use to React 19 patterns (ref as prop, use() instead of useContext()).
  • Use Case: Refactor a messaging composer that uses many boolean props into ChannelComposer, ThreadComposer, and EditComposer backed by a shared Composer.Provider so custom UI outside the frame can read or submit state.

Quick Start

Use the vercel-composition-patterns guidance to convert a Composer with many boolean props into explicit variant components that share a provider-based context.

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 with too many boolean props?

Replace boolean prop conditionals in React components with compound components sharing a single context, provider-based state interfaces, and explicit variant components to eliminate exponential conditional logic and reduce duplicated implementations.

What is the compound component pattern in React?

The compound component pattern designs components as composable pieces sharing a single context to avoid prop drilling, exposing generic state, actions, and meta interfaces via providers so different providers can power the same UI.

How do I migrate context usage to React 19 APIs?

Migrate context usage to React 19 by replacing useContext() with the use() API and handling refs directly as props, modernizing provider-based state management and ref forwarding in composable compound components.

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

Use explicit variant components instead of boolean props when feature toggles cause tightly coupled state and duplicated implementations, creating explicit variants like ChannelComposer and ThreadComposer backed by a shared provider to simplify reasoning and enable reuse.

Does using children composition over render props improve React maintainability?

Children composition over render props improves React maintainability by providing clarity in component composition, simplifying reasoning when building composable compound components and provider-based state interfaces.

Can I apply composition patterns during a React 19 migration?

Apply composition patterns during a React 19 migration to modernize ref handling and context usage, converting monolithic components into compound components using the use() API and ref as prop alongside provider-based state management.