React · Middle · Question 47 of 75

How do you run a query only after user.id is received from another query?

Explanation

While enabled is false, the query doesn't run (status pending). Calling a hook conditionally breaks the rules of hooks, and a manual refetch in an effect is needless complexity. user.id should be part of the second query's key.

Further reading

Problem with a question

React · Middle · question 47

Test yourself

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

Take this quiz