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

How does React.Children.only relate to a component using children?

Short interview answer

It's a utility that throws if children isn't exactly one React element, useful when a component's contract genuinely requires a single child, such as a component that clones and augments its one child with extra props.

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