fetchInfiniteQuery(...)
The method facilitates the fetching of paginated data. See TanStack queryClient.fetchInfiniteQuery ๐ด documentation for more details.
tip
fetchInfiniteQuery
is particularly useful for server-side data fetching (SSR). When used on the server, it automatically
provides all the retry logic and caching capabilities inherent to TanStack Query.
This makes it an excellent choice for efficient and robust server-side data retrieval, ensuring your application benefits
from built-in error handling and performance optimizations.
const result = api.<service>.<operation>.fetchInfiniteQuery(
{
parameters,
...fetchInfiniteQueryOptions,
}
);
Argumentsโ
-
parameters: { path, query, header } | QueryKey | void
- OpenAPI request parameters for the query, strictly-typed โจ
parameters
will be used to generate theQueryKey
fetchInfiniteQueryOptions?: FetchInfiniteQueryOptions
requestFn?: RequestFn
- Optional, a function that will be used to execute the request
- The function should be provided, otherwise it will throw an error if default
queryFn
is not set previously usingQueryClient.setDefaultOptions(...)
method
baseUrl?: string
- Optional, the base URL of the API
...fetchInfiniteQueryOptions?: FetchInfiniteQueryOptions
- Optional, represents the rest options of the fetchInfiniteQuery(...) ๐ด method
queryOptions.queryFn
could be provided instead ofrequestFn
queryOptions.queryKey
could be provided instead ofparameters
- Optional, represents the rest options of the fetchInfiniteQuery(...) ๐ด method