usePrefetchInfiniteQuery(options)
Options
You can pass everything to usePrefetchInfiniteQuery
that you can pass to queryClient.prefetchInfiniteQuery
. Remember that some of them are required as below:
queryKey: QueryKey
queryFn: (context: QueryFunctionContext) => Promise<TData>
initialPageParam: TPageParam
getNextPageParam: (lastPage, allPages, lastPageParam, allPageParams) => TPageParam | undefined | null
undefined
or null
to indicate there is no next page available.Returns
The usePrefetchInfiniteQuery
does not return anything, it should be used just to fire a prefetch during render, before a suspense boundary that wraps a component that uses useSuspenseInfiniteQuery
“This course is the best way to learn how to use React Query in real-world applications.”—Tanner LinsleyCheck it out