State Management · Middle · Question 29 of 75
Which queries does invalidateQueries({ queryKey: ['todos'] }) match?
- ✓Correct answer: Every query whose key starts with
['todos'] - 2Only a query with the exact key
['todos'] - 3All queries in the cache
Explanation
Prefix matching makes hierarchical keys useful: ['todos'] → ['todos', 'list', filters] → ['todos', 'detail', id]. Use exact: true for an exact match.