State Management · Junior · Question 40 of 75

What are the two required parts of useQuery?

Explanation

useQuery({ queryKey: ['todo', id], queryFn: () => fetchTodo(id) }). The key identifies the cached data; everything the request depends on goes into it, so changing id loads different data.

Further reading

Problem with a question

State Management · Junior · question 40

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