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

Why is testing a custom hook in isolation sometimes a smell?

Short interview answer

A hook exists to be used by components, so testing it through a small host component exercises it the way it actually runs. Isolated hook tests are justified for genuinely complex reusable logic, but for most hooks a component test covering the behavior is more valuable and less brittle.

Key takeaway

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

← Back to Testing React components

Related questions