Testing · Junior · Question 78 of 78

Why test a custom hook through a component (or renderHook) rather than calling it directly?

Explanation

A direct call breaks the rules of hooks. renderHook renders a tiny test component around the hook.

Further reading

Problem with a question

Testing · Junior · question 78

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz