table-state
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLoad first for shared ownership, initialization, updater, and reset rules.
intent load @tanstack/table-core#table-stateuseTabletable.state.get()table.store.statetable.Subscribe请先加载 以了解共享所有权、初始化、更新器和重置规则。
intent load @tanstack/table-core#table-stateuseTabletable.state.get()table.store.statetable.SubscribeControlled slice setup
受控切片设置
tsrx
import { useState } from 'octane'
import {
rowPaginationFeature,
tableFeatures,
useTable,
} from '@tanstack/octane-table'
const features = tableFeatures({ rowPaginationFeature })
const columns = [{ accessorKey: 'name' }]
const data = [{ name: 'Ada' }]
function PageStatus() @{
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 20 })
const table = useTable({
features,
columns,
data,
state: { pagination },
onPaginationChange: setPagination,
})
<button onClick={() => table.nextPage()}>
Page {String(table.state.pagination.pageIndex + 1)}
</button>
}tsrx
import { useState } from 'octane'
import {
rowPaginationFeature,
tableFeatures,
useTable,
} from '@tanstack/octane-table'
const features = tableFeatures({ rowPaginationFeature })
const columns = [{ accessorKey: 'name' }]
const data = [{ name: 'Ada' }]
function PageStatus() @{
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 20 })
const table = useTable({
features,
columns,
data,
state: { pagination },
onPaginationChange: setPagination,
})
<button onClick={() => table.nextPage()}>
Page {String(table.state.pagination.pageIndex + 1)}
</button>
}Reactive boundaries
响应式边界
- Pass both the controlled value and its callback. Octane setters accept Table's value-or-updater callbacks; a callback alone cannot feed the new value back.
- Render as a component. Calling it as a normal function shares the owner's compiler slots instead of creating an independent hook scope.
<table.Subscribe> - stages fresh options for same-render reads. Controlled state reaches the store only from an accepted layout commit, so abandoned work cannot publish speculative values.
useTable - A stable atom from is a direct synchronous owner. Table writes reach it immediately; it takes precedence over controlled
@tanstack/octane-storefor the same slice.state - Keep features, columns, and data stable. Use the default selector until render cost justifies narrower subscriptions.
- 同时传入受控值及其回调。Octane的setter接受Table的值或更新器回调;仅靠回调无法将新值回传。
- 将 作为组件渲染。将其作为普通函数调用会共享所有者的编译器槽位,而不会创建独立的hook作用域。
<table.Subscribe> - 为同渲染读取暂存最新选项。受控状态仅在布局提交被接受时才会到达store,因此被放弃的工作不会发布推测值。
useTable - 来自 的稳定Atom是直接的同步所有者。Table的写入会立即同步到它;对于同一切片,它的优先级高于受控
@tanstack/octane-store。state - 保持features、columns和data的稳定性。在渲染成本足以证明需要更窄范围的订阅之前,请使用默认选择器。
Read for the task
任务相关阅读
For advanced reactive boundaries, shared atoms, or detailed subscription examples, read reactivity. For construction or rendering setup, read getting-started.
如需了解高级响应式边界、共享Atom或详细的订阅示例,请阅读 响应式。如需了解构建或渲染设置,请阅读 入门指南。
API discovery
API 查找方式
Inspect , the matching sidecar, and . This package publishes authored source; core APIs are in installed .
node_modules/@tanstack/octane-table/src/index.d.ts*.tsrx.d.tssrc/types.ts@tanstack/table-core/dist/请查看 、配套的 侧文件以及 。此包发布了原始源码;核心API位于已安装的 目录中。
node_modules/@tanstack/octane-table/src/index.d.ts*.tsrx.d.tssrc/types.ts@tanstack/table-core/dist/