Skip to content
React·Intermediate·Conceptual·1 min read

Why does children work well for something like a generic Modal or Card wrapper?

Short interview answer

The wrapper's job is purely structural — providing an overlay, a border, spacing — and has no reason to know or care what content it's wrapping, so children lets any content compose into it without the wrapper needing new props per use case.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Component composition patterns

Related questions