Skip to main content
The useSuspenseQuery hook is a specialized version of useQuery designed for React Suspense. It always suspends while fetching and throws errors to error boundaries, providing a more streamlined type signature.

Import

Signature

Parameters

object
required
The query options object.
QueryClient
Override the default QueryClient.
The following options are NOT available in useSuspenseQuery because they are automatically set:
  • enabled - Always true
  • suspense - Always true
  • throwOnError - Always throws errors to error boundaries
  • placeholderData - Not supported

Returns

object
The query result object. Data is always defined (never undefined).

Examples

Basic Usage

With Error Boundary

Multiple Suspense Queries

With Select

Nested Suspense Boundaries

Notes

useSuspenseQuery requires React’s Suspense and Error Boundary to be set up in parent components.
The data property is always defined (never undefined) when the component renders, providing better type safety.
Errors are automatically thrown to the nearest error boundary, so you don’t need to handle error states manually.
The skipToken cannot be used with useSuspenseQuery. Use regular useQuery with enabled: false if you need conditional fetching.