vercel-composition-patterns

Guide React component composition with compound components and explicit variants.

Updated Aug 30, 2025
One-click install
npx skills add https://github.com/kristofferaas/deep-stortinget --skill vercel-composition-patterns-kristofferaas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vercel-composition-patterns
Source: https://github.com/kristofferaas/deep-stortinget/tree/main/.agents/skills/vercel-composition-patterns
Command: npx skills add https://github.com/kristofferaas/deep-stortinget --skill vercel-composition-patterns-kristofferaas

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill addresses the complexity of building maintainable and scalable React components by providing patterns to avoid prop proliferation and improve code organization.

Core Features & Use Cases

  • Component Architecture: Learn to avoid boolean prop proliferation and use compound components effectively.
  • State Management: Implement strategies for decoupling state from UI, defining generic context interfaces, and lifting state into providers.
  • Implementation Patterns: Prefer composing children over render props and create explicit component variants.
  • React 19 APIs: Understand new APIs like use() and ref handling.
  • Use Case: Refactor a large, monolithic React component with many conditional props into a set of smaller, composable components that are easier to manage and extend.

Quick Start

Use the vercel-composition-patterns skill to refactor a React component with many boolean props into explicit variants.

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

To refactor a React component with many boolean props, break it into explicit variants and use compound components to avoid prop proliferation. This pattern creates smaller, composable components that are easier to manage and extend.

What is the compound components pattern in React?

The compound components pattern in React is an architecture technique that composes multiple smaller components together instead of passing many conditional props. It decouples state from UI by lifting it into providers, improving code organization.

How does the React 19 use() hook change state management?

The React 19 use() hook changes state management by allowing components to read resources like promises or context directly during render. Combined with explicit component variants and generic context interfaces, it simplifies decoupling state from UI.

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

You should use compound components instead of render props in React when you want to avoid prop proliferation and improve maintainability. Preferring composing children over render props creates explicit variants and a more scalable component architecture.

Can I decouple state from UI in large React components?

Yes, you can decouple state from UI in large React components by defining generic context interfaces and lifting state into providers. This state management strategy prevents monolithic components and ensures scalable React composition.

What are explicit component variants in React and why avoid boolean props?

Explicit component variants in React are separate, purpose-built components created instead of using boolean props to conditionally render UI. Avoiding boolean prop proliferation prevents complex conditional logic and makes component architecture easier to extend.