Skip to content

postgrestx-monorepo v0.0.1


postgrestx-monorepo / tanstack/src / useInfiniteList

Function: useInfiniteList()

useInfiniteList<Table>(tableName, params, options?): UseInfiniteQueryResult<{ items: Table[]; nextFrom?: number; }, unknown>

Defined in: packages/tanstack/src/index.ts:438

Infinite scrolling list helper built on useInfiniteQuery. Computes nextFrom based on total count / Content-Range.

Type Parameters

Table

Table = unknown

Parameters

tableName

string

params

ListArgs & object

options?

UseInfiniteQueryOptions<{ items: Table[]; nextFrom?: number; }, unknown, { items: Table[]; nextFrom?: number; }, readonly unknown[], unknown>

Returns

UseInfiniteQueryResult<{ items: Table[]; nextFrom?: number; }, unknown>

Example

ts
const products = useInfiniteList<Product>('products', { pageSize: 50, select: 'id,name,price' }, {
  getNextPageParam: (last) => last.nextFrom
})