React composition patterns
Vercel Engineering's composition patterns as questions: compound components, providers that own state, explicit variants over boolean props, and React 19's API changes.
Try a card
React composition patterns1 of 3
Say it in your head first.
Questions
- 01Why are boolean props like
isThread,isEditingandisDMThreada poor way to customize a component? - 02Instead of a
Composerwith anisThreadflag, how does composition build a thread composer? - 03What is a compound component?
- 04In a compound component, where does a subcomponent like
Composer.Inputget its state from? - 05In a provider-based component, where should the knowledge of how state is managed live?
- 06What does isolating state management in the provider let you change without touching the UI?
- 07What three parts make up the generic context interface in these patterns?
- 08What's the core principle behind the generic context interface?
…and 11 more cards. The answers are yours to find.
