跳到正文
Skillpedia
网站与界面(前端)29k · #9834

core

它能做什么

这项技能解释 TanStack Table 的共享基础,即管理表格状态和行处理的库。适合在使用框架适配器之前需要理解核心模型的开发者。

适用场景

  • ✓当你开始一个新表格,需要了解核心模型和稳定输入如何工作的时候。
  • ✓当你在使用某项可选的表格功能之前,需要确认它是否可用的时候。
  • ✓当你在编写不使用特定框架的集成代码的时候。

技能链接

https://github.com/TanStack/table/blob/main/packages/table-core/skills/core/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/TanStack/table/blob/main/packages/table-core/skills/core/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“在我构建表格之前,你能解释 TanStack Table v9 如何处理数据和列吗?”

每周 5 个新技能,1 分钟读完。

工作原理

它解释该库负责协调状态和行处理,而你的代码控制标记,并给出一个构建表格并读取其行的最小示例。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

TanStack Table core

TanStack Table coordinates state and row processing. The renderer owns markup, styles, semantics, and interaction accessibility. Use the installed framework adapter in UI code; use constructTable for framework-neutral integrations.

Minimal setup

<!-- skill-snippet:check -->
import {
  constructTable,
  createColumnHelper,
  tableFeatures,
} from '@tanstack/table-core'
import { storeReactivityBindings } from '@tanstack/table-core/store-reactivity-bindings'

type Person = { id: string; name: string }
const features = tableFeatures({
  coreReactivityFeature: storeReactivityBindings(),
})
const helper = createColumnHelper<typeof features, Person>()
const columns = helper.columns([helper.accessor('name', { header: 'Name' })])
const data: Person[] = [{ id: '1', name: 'Ada' }]
const table = constructTable({
  features,
  columns,
  data,
  getRowId: (row) => row.id,
})

for (const row of table.getRowModel().rows) {
  console.log(row.getAllCells().map((cell) => cell.getValue()))
}

Essential constraints

  • The core row model is automatic. Optional APIs and state exist only after their feature is registered.
  • Keep features, data, and columns stable between meaningful changes. Derive changing arrays with the adapter's memo/computed mechanism; an inline .map(), .filter(), column factory, or fresh [] fallback invalidates model work and can cause render loops.
  • Let createColumnHelper and helper.columns() preserve accessor value types. Derive feature types from the concrete registry when an explicit boundary is needed.
  • Call row, cell, column, and header methods on their instance. Use row.getValue('name') or a callback that calls it; extracting const { getValue } = row loses its this receiver.
  • Render the final table.getRowModel().rows. The table object itself is not a DOM component.

Read for the current task

Task Read
Add or repair optional features, processing slots, or prerequisites Feature architecture, then its relevant feature reference
Choose state ownership, initialize or reset state Shared state
Fix ColumnDef inference, reusable options, or scoped meta TypeScript inference
Diagnose a missing export, option, state slice, or instance method API discovery
Implement row numbers, identity, or display-index behavior Rows
Author behavior beyond built-ins or typed meta Custom features
Migrate an existing v8 table Migration audit

For framework construction and rendering, load the installed package's getting-started skill with intent load <package>#getting-started, replacing <package> with the actual adapter package, such as @tanstack/react-table. For reactive reads or controlled wiring, load that package's table-state skill directly.

Installed API discovery

Start at node_modules/@tanstack/table-core/dist/index.d.ts and follow exported declarations. Adapter declaration layouts and missing-API diagnosis are in API discovery; read it when the expected export or declaration path is absent.

常见问题

为什么数据和列必须保持稳定?

这项技能说明,在每次渲染时更改它们会使模型工作失效,因此应使用适配器的 memo 或计算机制来派生变化的数组。

库会替我绘制表格吗?

不会,这项技能说明渲染器负责标记、样式和语义,而库负责管理状态和行。

所有表格功能默认都开启吗?

不是,可选的 API 和状态只有在其功能注册后才存在。

详情

作者的原始描述

Use TanStack Table v9 core architecture, stable data and columns, and inferred types. Route setup, missing APIs, row models, state, features, and framework-specific work.

repo: TanStack/table

热度

GitHub 星标
29k
排名
#9834
许可证
MIT
更新时间
2026/10/21

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能