Skip to content

postgrestx-monorepo v0.0.1


postgrestx-monorepo / tanstack/src / useList

Function: useList()

useList<Table>(tableName, args?, options?): UseQueryResult<ListResult<Table>, unknown>

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

Fetch a list of rows with optional filtering, ordering and pagination hints. Returns data plus total and range metadata when the server provides Content-Range.

Type Parameters

Table

Table = unknown

Row shape (defaults to unknown) – supply for strong typing.

Parameters

tableName

string

args?

ListArgs

options?

UseQueryOptions<ListResult<Table>, unknown, ListResult<Table>, readonly unknown[]>

Returns

UseQueryResult<ListResult<Table>, unknown>

Examples

ts
const query = useList<User>('users', { select: 'id,name', limit: 20 })
ts
useList<User>('users', { profile: 'tenant_a', select: 'id,name' })