React · Senior · Question 40 of 75
What must you specify in useInfiniteQuery?
- ✓Correct answer:
initialPageParamand agetNextPageParamfunction - 2
pageSizeandtotalPagesto calculate the number of requests - 3A
cursorin the query key and a manualrefetchon scroll
Explanation
Data is stored as { pages, pageParams }. getNextPageParam(lastPage) returns the next page's cursor or undefined when there are no more pages (hasNextPage becomes false). Loading more is fetchNextPage(), often triggered by an Intersection Observer.