
const queryFn = (...queryKey, fetchMoreVariable) // => Promiseconst {isFetchingMore,fetchMore,canFetchMore,...result} = useInfiniteQuery(queryKey, queryFn, {...options,getFetchMore: (lastPage, allPages) => fetchMoreVariable})
Options
The options for useInfiniteQuery are identical to the useQuery hook with the addition of the following:
getFetchMore: (lastPage, allPages) => fetchMoreVariable | booleanReturns
The returned properties for useInfiniteQuery are identical to the useQuery hook, with the addition of the following:
isFetchingMore: false | 'next' | 'previous'paginated mode, this will be true when fetching more results using the fetchMore function.fetchMore: (fetchMoreVariableOverride) => Promise<UseInfiniteQueryResult>fetchMoreVariableOverride allows you to optionally override the fetch more variable returned from your getFetchMore option to your query function to retrieve the next page of results.canFetchMore: booleanpaginated mode, this will be true if there is more data to be fetched (known via the required getFetchMore option function).The latest TanStack news, articles, and resources, sent to your inbox.