The composition king: compound components

from blog nickb.dev, | ↗ original
Repeatedly adding orthogonal properties to a React component causes unwieldy bloat. Transitioning to a compound component will invert control and allow clients the flexibility they need. It comes at a cost, though. What are these costs, can we mitigate them, and what are alternative solutions? Let’s build a motivating example of a component’s...