Skip to main content

Function: useTable()

useTable<Row>(spec, rows, options?): object

Defined in: packages/sdvtables/src/react/index.tsx:56

Subscribe a component to a createTable engine via useSyncExternalStore. The engine is created once per component: a new rows array is handed to table.setRows (sort, filters, page and selection kept), and only a structural spec change rebuilds it, so neither needs to be memoized. options are INITIAL state: a later change is ignored.

Type Parameters​

Row​

Row

Parameters​

spec​

TableSpec<Row>

rows​

readonly Row[]

options?​

TableOptions = {}

Returns​

object

snapshot​

snapshot: TableSnapshot<Row>

table​

table: Table<Row>