Testing · Middle · Question 28 of 75
How do you test a component that uses TanStack Query?
- ✓Correct answer: Wrap it in a fresh
QueryClientper test withretry: false, and mock the network with MSW - 2Share one
QueryClientacross all tests for speed - 3Mock
useQueryto return{ data }
Explanation
A shared client leaks cache between tests; retries make error tests slow.