Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

TanStack · Hook

useSuspenseQueries

useSuspenseQueries runs multiple TanStack Query requests concurrently under React Suspense. It returns their results or an optional combined value, with each query's data guaranteed to be defined.

Since
v5

How it works

The hook accepts an array of query configurations and optionally a combine function. It suspends while required data loads, runs the queries in parallel, and returns a combined value or the usual query-result structure with defined data for every query.

Syntax

function useSuspenseQueries<T, TCombinedResult>(options: object, queryClient?: QueryClient): TCombinedResult;

Parameters

NameTypeDescription
optionsobjectConfiguration object containing the queries array and optional combine function; each query follows useQueries options with the documented exclusions.
queryClientQueryClientOptional QueryClient used by the hook.

Returns

TCombinedResult; without combine, the result has the useQueries structure, with defined data, no isPlaceholderData, and status limited to success or error.

Key points

  • Pass query configurations in queries; combine is optional and can produce a single application-specific value.
  • combine maps the individual query results into one returned value.
  • Each returned query result has defined data at the type level.
  • The result model omits loading-style uncertainty: status is success or error, with derived flags matching it.
  • The hook does not support useQueries' top-level subscribed option.

Common mistakes

  • Individual queries cannot configure throwOnError, enabled, or placeholderData.
  • The combined result uses structural sharing where possible, so do not assume a freshly allocated value on every render.

Example: Parallel suspense queries

import { useSuspenseQueries } from '@tanstack/react-query'

async function fetchJson<T>(url: string): Promise<T> {
  const response = await fetch(url)
  if (!response.ok) throw new Error(`HTTP ${response.status}`)
  return response.json() as Promise<T>
}

export function Dashboard() {
  const [users, teams] = useSuspenseQueries({
    queries: [
      { queryKey: ['users'], queryFn: () => fetchJson<string[]>('/api/users') },
      { queryKey: ['teams'], queryFn: () => fetchJson<string[]>('/api/teams') },
    ],
    combine: (results) => ({ users: results[0], teams: results[1] }),
  })

  return <p>{users.length} users in {teams.length} teams</p>
}

Runs both requests through Suspense and combines their results into one value.

When to use it

Load independent dashboard data in parallel

A dashboard needs independent users, teams, and metrics before rendering.

Avoid serial suspension

Several suspenseful queries belong to one component and should not create a waterfall.

Normalize results with combine

A component wants a domain-specific object instead of an array of query results.

Interview questions

QWhat problem does useSuspenseQueries solve?

It is the Suspense-oriented multi-query hook. It receives a queries array, starts those queries in parallel, and can transform their results with combine; unlike separate suspense hooks, it avoids serial suspension.

Follow-up: Why not call multiple useSuspenseQuery hooks? Each can suspend before later hooks start, creating a request waterfall; useSuspenseQueries coordinates them together.

QWhich options are unavailable?

Its options follow useQueries, with two differences: top-level subscribed is unsupported, and each query cannot set throwOnError, enabled, or placeholderData. The hook's signature also accepts an optional QueryClient.

Follow-up: How would a component conditionally skip one query? Suspense query configuration cannot use enabled, so restructure the component or query set rather than disabling an individual entry.

QWhat does the hook return?

Without combine, the return has the same overall structure as useQueries, but every query's data is guaranteed to be defined. isPlaceholderData is absent, and status is limited to success or error with corresponding derived flags.

Follow-up: What should handle errors? Use the surrounding Suspense and error-boundary model rather than relying on an enabled or placeholderData escape hatch.

  • useQueries
  • useSuspenseQuery
  • useSuspenseInfiniteQuery
  • usePrefetchQuery
  • QueryClient

Source: useSuspenseQueries | TanStack Query React Docs. Checked 2026-10-15.