function Subscribe<TFeatures, TData, TSelected>(props): ReactNode | Promise<ReactNode>;
Defined in: Subscribe.ts:58
A React component that allows you to subscribe to the table state.
This is useful for opting into state re-renders for specific parts of the table state.
TFeatures extends TableFeatures
TData extends RowData
TSelected = { }
SubscribeProps<TFeatures, TData, TSelected>
ReactNode | Promise<ReactNode>
// As a standalone component
<Subscribe table={table} selector={(state) => ({ rowSelection: state.rowSelection })}>
{({ rowSelection }) => (
<div>Selected rows: {Object.keys(rowSelection).length}</div>
)}
</Subscribe>
// As table.Subscribe (table instance method)
<table.Subscribe selector={(state) => ({ rowSelection: state.rowSelection })}>
{({ rowSelection }) => (
<div>Selected rows: {Object.keys(rowSelection).length}</div>
)}
</table.Subscribe>