React·Intermediate·Conceptual·1 min read
Can a compound component be made to fail helpfully if a sub-component is used outside its parent's provider?
Short interview answer
Yes — the shared context's default value can be set to undefined or a sentinel, and each sub-component can throw a clear error if it reads that sentinel, rather than silently rendering broken behavior.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.