Open History to see the last commit
1---
2id: InfiniteQueryPageParamsOptions
3title: InfiniteQueryPageParamsOptions
4---
5β
6Defined in: [packages/query-core/src/types.ts:485](https://github.com/TanStack/query/blob/main/packages/query-core/src/types.ts#L485)
7β
8The page param options of an infinite query: `initialPageParam`, and the `getNextPageParam` and
9`getPreviousPageParam` functions that compute the params of the pages around it.
10β
11## Extends
12β
13- [`InitialPageParam`](InitialPageParam.md)\<`TPageParam`\>
14β
15## Extended by
16β
17- [`InfiniteQueryObserverOptions`](InfiniteQueryObserverOptions.md)
18β
19## Type Parameters
20β
21### TQueryFnData
22β
23`TQueryFnData` = `unknown`
24β
25### TPageParam
26β
27`TPageParam` = `unknown`
28β
29## Properties
30β
31| Property | Type | Description |
32| ------ | ------ | ------ |
33| <a id="property-getnextpageparam"></a> `getNextPageParam` | (`lastPage`: `TQueryFnData`, `allPages`: `TQueryFnData`[], `lastPageParam`: `TPageParam`, `allPageParams`: `TPageParam`[]) => `TPageParam` \| `null` \| `undefined` | This function can be set to automatically get the next cursor for infinite queries. The result will also be used to determine the value of `hasNextPage`. |
34| <a id="property-getpreviouspageparam"></a> `getPreviousPageParam?` | (`firstPage`: `TQueryFnData`, `allPages`: `TQueryFnData`[], `firstPageParam`: `TPageParam`, `allPageParams`: `TPageParam`[]) => `TPageParam` \| `null` \| `undefined` | This function can be set to automatically get the previous cursor for infinite queries. The result will also be used to determine the value of `hasPreviousPage`. |
35| <a id="property-initialpageparam"></a> `initialPageParam` | `TPageParam` | The page param to start from when an infinite query has no pages yet. It is passed to `queryFn` as `pageParam` for the first page; every page after that gets the value returned by `getNextPageParam` or `getPreviousPageParam`. It only applies while the query has no pages: once a first page exists, refetching starts from that page's own param instead. |