React · Junior · Question 50 of 75
What must you do before using useQuery in an app?
- ✓Correct answer: Create a
QueryClientand wrap the app in its provider - 2Nothing:
useQuerycreates a global cache on its first call - 3Add a Redux store where TanStack Query keeps its cache
Explanation
QueryClient holds the cache and default settings, and the provider makes it available to hooks. Create the client once (outside a component or via useState), otherwise the cache resets on every render. TanStack Query doesn't need Redux.