Overview
A React composition guide on one theme: shape component boundaries so they grow without forks. Ten patterns, each naming the problem it solves and the cost it accepts. Children as content slots, props as knobs — a component with six boolean flags is really three components. Compound pieces share one internal contract for structural wiring only, never business data. Explicit variants replace boolean soup, so impossible combinations simply can't be written. State negotiated between siblings lifts to their common parent. Empty slots, loading content and empty lists each carry their own shape. Escape hatches come last and named; layout owns geometry while content owns meaning; tests ride public props and user-visible behavior.
Pattern cards expand each rule into applicable code — for reviewing component APIs, taming boolean-prop sprawl, and giving the team one shared vocabulary.
Where it helps
- Review a component library's API: flag explosion and contract leaks, called out
- Refactor Tabs/Menu/Accordion into the compound pattern
- Make impossible state combinations unnameable with explicit variants
- Set the controlled/uncontrolled contract for dual-mode components
#react#composition#patterns#frontend
Examples
Examples describe the request and the shape of the expected deliverable; they are not completed run results.
01Example prompt
This Card has 11 boolean flags: propose the refactor — children as slots, an explicit variant set — and list the invalid state combinations it kills.
Expected output
A refactor blueprint: the new API shape, a migration map, and the state combinations now impossible to write.
02Example prompt
Our Dialog context smuggles business data and half the consumers read it directly: redraw the interface/implementation line.
Expected output
A stable useDialog interface proposal with migration steps and each consumer rewrite enumerated.
Requirements and limits
- Install platforms
- iOS: iOS · Android: Android
- Script runtime
- No script runtime (guidance and workflow)
- Minimum app version
- iOS: 1.7.59
Reviewed permission scope
iOS · Android
- Capabilities
- Read workspace files
- Review decision
- Approved
- Review stage
- Static content review
- Reviewed on
- 2026-10-28
Implementation and runtime details
- Adaptation stage
- frozen
iOS
- Capabilities
- Read workspace files
Android
- Capabilities
- Read workspace files
License and source
Source and trace details
License
MPL-2.0
Floe original guide. Replaces the original candidate with independently authored content; upstream text is not distributed. Candidate identity and provenance remain in the package.
- Publisher
- JiangNanGenius
- Publication commit (retrieval)
- 25e07dbeeb6cc93c2fe83ddc72a34302cc40832a
- Audited source commit
- 84c524b6fb483e4cad94db076e7d9c9962966c19
- Signed catalog digest
- iOS 46196ba57ed7ea7f22085e74b113207f31193e820ab8983cf7a60eee953f2340 · Android 16de89d019e2057804a40f215485ccb09d5495a25864b34d681168eeaf8f9697
- Publication snapshot (UTC)
- 2026-10-31
Publication commit 25e07dbeeb, audited source 84c524b6fb; catalog digest iOS 46196ba57ed7… · Android 16de89d019e2….
Versions and status
Version records ship with the signed catalog; the target and released versions are shown below.
- Adaptation
- Ready
- Publication state
- Curated skills are available
- Released version
- 1.0.1