Docs
Cloudflare
Railway
CodeRabbit
WorkOS
Netlify
AG Grid
Clerk
SerpAPI
OpenRouter
Unkey
Sentry
Electric
Prisma
Cloudflare
Railway
CodeRabbit
WorkOS
Netlify
AG Grid
Clerk
SerpAPI
OpenRouter
Unkey
Sentry
Electric
Prisma
Table API Reference
Column API Reference
Row API Reference
Cell API Reference
Header API Reference
Features API Reference
Static Functions API Reference
Legacy API Reference
Table API Reference

useTable

Function: useTable()

ts
function useTable<TFeatures, TData, TSelected>(tableOptions, selector?): ReactTable<TFeatures, TData, TSelected>;
function useTable<TFeatures, TData, TSelected>(tableOptions, selector?): ReactTable<TFeatures, TData, TSelected>;

Defined in: useTable.ts:142

Creates a React table instance backed by TanStack Store atoms.

The optional selector projects from table.store; the selected value is exposed on table.state and compared shallowly for React re-renders. Omit the selector to subscribe to every registered table state slice, or pass a narrower selector and use table.Subscribe lower in the tree for targeted subscriptions.

Type Parameters

TFeatures

TFeatures extends TableFeatures

TData

TData extends RowData

TSelected

TSelected = TableState<TFeatures>

Parameters

tableOptions

TableOptions<TFeatures, TData>

selector?

(state) => TSelected

Returns

ReactTable<TFeatures, TData, TSelected>

Example

tsx
const table = useTable(
  {
    _features,
    _rowModels: {},
    columns,
    data,
  },
  (state) => ({ pagination: state.pagination }),
)

table.state.pagination
const table = useTable(
  {
    _features,
    _rowModels: {},
    columns,
    data,
  },
  (state) => ({ pagination: state.pagination }),
)

table.state.pagination