React · Senior · Question 39 of 75
How does useSuspenseQuery differ from useQuery?
- ✓Correct answer:
<Suspense>handles loading, a boundary handles errors,datais defined - 2It caches data forever and never refetches
- 3It works only in Server Components and doesn't need a provider
Explanation
The component suspends until data arrives, so there's no need for isPending checks inside, and data isn't undefined. Errors propagate to the error boundary (reset via QueryErrorResetBoundary). Caveats: the enabled option isn't available, and sequential suspensions create request waterfalls.