Skip to main content
Fetch paginated or infinite scrolling data with the useInfiniteQuery composable. It manages multiple pages of data and provides methods to load more pages.

Signature

Parameters

UseInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>
required
Configuration options for the infinite query. Can be a reactive ref or getter function.
QueryClient
Custom QueryClient instance. If not provided, uses the client from context.

Returns

object
Reactive refs containing infinite query state and methods.

Type Parameters

  • TQueryFnData - Type of data returned by each page
  • TError - Type of error (defaults to DefaultError)
  • TData - Type of final data (defaults to InfiniteData<TQueryFnData>)
  • TQueryKey - Type of the query key (defaults to QueryKey)
  • TPageParam - Type of page parameter (defaults to unknown)

Examples

Basic Infinite Scroll

Cursor-Based Pagination

Bi-directional Pagination

With TypeScript

Reactive Page Parameters

Infinite Scroll with Intersection Observer

Refetch All Pages