State Management · Junior · Question 20 of 75

What does useContext(ThemeContext) return if there's no provider above?

Explanation

The default is used when no provider is found up the tree. A common pattern is createContext(null) plus a custom hook useAuth() that throws a clear error if the provider is missing.

Further reading

Problem with a question

State Management · Junior · question 20

Test yourself

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

Take this quiz