vercel-composition-patterns

Refactor React UI components using composition patterns to eliminate boolean props.

25|3|Updated Mar 3, 2025
One-click install
npx skills add https://github.com/teknokomo/universo-platformo-react --skill vercel-composition-patterns-teknokomo
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/teknokomo/universo-platformo-react/tree/main/.agents/skills/composition-patterns
Command: npx skills add https://github.com/teknokomo/universo-platformo-react --skill vercel-composition-patterns-teknokomo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Refactor React UI to avoid boolean prop proliferation by embracing composition patterns, which yields more predictable, reusable components and a cleaner API surface.

Core Features & Use Cases

  • Compound components and shared context to assemble flexible UI without prop drilling.
  • Provider-based state management that decouples UI from state implementation, enabling swap-in of local or global state.
  • Explicit variants (e.g., ThreadComposer, EditMessageComposer, ForwardMessageComposer) to document behavior and improve maintainability.
  • Works with React 19 APIs for cleaner context usage and modern patterns.

Quick Start

Instantiate explicit variant components within a provider to compose UI that can share state.

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?▼

Refactor React components to avoid boolean prop proliferation by applying composition patterns like compound components and explicit variants. This yields more predictable, reusable UI components and a cleaner API surface.

What is the best way to manage shared state in React without prop drilling?▼

Manage shared state without prop drilling by using provider-based state management and shared context. This decouples UI from state implementation, enabling you to swap local or global state as needed.

How do compound components work in React?▼

Compound components in React assemble flexible UI by combining multiple specialized parts through a shared context. This pattern allows individual components to communicate internally without requiring explicit prop passing.

Does this React composition approach work with React 19 APIs?▼

Yes, this approach works with React 19 APIs for cleaner context usage. It incorporates modern context patterns through the use() hook to satisfy explicit variants and provider-based state requirements.

When should I use explicit variants like ThreadComposer instead of boolean props?▼

Use explicit variants like ThreadComposer or EditMessageComposer when you need to document distinct component behaviors. This pattern improves maintainability by replacing complex conditional logic with self-contained components.

Can I decouple React UI from state implementation using context providers?▼

Yes, you can decouple React UI from state implementation using context providers. This provider-based state management pattern enables swapping local or global state implementations without altering the UI components.