React · Middle · Question 45 of 75

Which queries does invalidateQueries({ queryKey: ['todos'] }) invalidate?

Explanation

Matching is by key prefix by default, which makes hierarchical keys convenient: ['todos'] → ['todos', 'list', filters] → ['todos', 'detail', id]. Exact matching is enabled with exact: true. Keys are often moved into a factory (todoKeys.detail(id)).

Further reading

Problem with a question

React · Middle · question 45

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