Skip to content

useTable

ts
function useTable<TItem>(options: UseTableOptions<TItem>): TableState<TItem>;

useTable is headless remote-table state. It owns query composition and persistence, but not a table renderer, a router, or a global store.

Returned state

ValueDescription
page, itemsPerPageCurrent pagination; changing either triggers a new request.
sorting, filteringQuery Kit UI state persisted by persistenceKey.
columnOrder, columnVisibility, columnPinningPersisted presentational metadata for a renderer.
columns, fields, queryParamsDerived visible columns, field grammar, and outgoing query.
items, totalItems, totalPagesLatest accepted server response.
loading, errorState of the most recent request.

Actions

ActionBehavior
initialize()Syncs the input route page, refreshes, then calls onInitialized.
refresh()Fetches the current query. A newer request wins over an older one.
updateRow(row)Shallow-merges a row with the matching identityKey and triggers the shallow ref.

See the table guide for the complete option reference and router-adapter example.

Released under the MIT License.