Skip to main content
Fetch paginated or infinite scrolling data with the createInfiniteQuery primitive. It manages multiple pages of data and provides methods to load more pages in SolidJS applications.

Signature

Parameters

Accessor<CreateInfiniteQueryOptions<TQueryFnData, TError, TData, TQueryKey, TPageParam>>
required
A Solid accessor (function) returning infinite query configuration options.
Accessor<QueryClient>
Accessor returning a custom QueryClient instance. If not provided, uses the client from context.

Returns

object
Reactive 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 Query Parameters

Infinite Scroll with Intersection Observer

Refetch All Pages

With Loading States

Page-Based Pagination

Notes

The options parameter must be an accessor (function) to integrate with SolidJS reactivity.
initialPageParam is required in v5. Make sure to provide it when creating infinite queries.
When using refetch(), all pages will be refetched. For better UX, consider using invalidateQueries to only refetch when needed.