0
Fork 0
mirror of https://github.com/TanStack/table.git synced 2026-11-18 18:55:54 +00:00
table/docs/framework/react/reference/index/functions/useTable.md
Kevin Van Cott 87c6bcc52a
feat(table-core): Further improve tree-shaking across features (#6626)
* feat(table-core): Further improve tree-shaking across features

Keep column ordering, column pinning, and row expanding code out of the
core bundle, route more cross-feature reads through feature stubs, and
stop allocating unused onAfterUpdate wrappers in production memos.

* refactor(table-core): register internal cross-feature fns as table APIs

Replace init*InstanceData function storage with @internal table APIs
registered via assignTableAPIs, route faceting through the
getCanGlobalFilter stub, and enforce feature boundaries with
import/no-restricted-paths. Regenerate reference docs and fix stale
docs config links.

---------
2026-10-12 09:51:47 -05:00

1.2 KiB

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

Defined in: src/useTable.ts:149

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

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

table.state.pagination