本文へスキップ
Skillpedia
WebサイトとUI(フロントエンド)29k · #9820

getting-started

できること

このスキルは、TanStack Tableを使ってPreactアプリにデータの表を作る方法を示します。Preactで直接動くテーブルライブラリを求める開発者向けです。

使う場面

  • ✓記録の一覧を表示するPreactのコンポーネントを作っているとき。
  • ✓Preactの表のヘッダーとセルが正しく描画される必要があるとき。
  • ✓後でPreactの表にQueryやVirtualの機能を追加する予定のとき。

スキルのリンク

https://github.com/TanStack/table/blob/main/packages/preact-table/skills/getting-started/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/TanStack/table/blob/main/packages/preact-table/skills/getting-started/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“チームのメンバーを表で一覧にするPreactのページを作っています。どう設定すればよいですか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

ヘルパーで列を定義し、フックで表を作り、ヘッダーと行をマップして表を描くコンポーネントの例を示します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Preact Table setup and integration

Before starting, run intent load @tanstack/table-core#core for the shared headless model and stable-input rules.

Setup

import { useState } from 'preact/hooks'
import {
  createColumnHelper,
  tableFeatures,
  useTable,
} from '@tanstack/preact-table'

type Person = { name: string }
const features = tableFeatures({})
const helper = createColumnHelper<typeof features, Person>()
const columns = helper.columns([helper.accessor('name', { header: 'Name' })])

export function PeopleTable() {
  const [data] = useState<Person[]>([{ name: 'Ada' }])
  const table = useTable({ features, columns, data })
  return (
    <table>
      <thead>
        {table.getHeaderGroups().map((group) => (
          <tr key={group.id}>
            {group.headers.map((header) => (
              <th key={header.id}>
                <table.FlexRender header={header} />
              </th>
            ))}
          </tr>
        ))}
      </thead>
      <tbody>
        {table.getRowModel().rows.map((row) => (
          <tr key={row.id}>
            {row.getAllCells().map((cell) => (
              <td key={cell.id}>
                <table.FlexRender cell={cell} />
              </td>
            ))}
          </tr>
        ))}
      </tbody>
    </table>
  )
}

Essential constraints

Use native @tanstack/preact-table and preact/hooks. V8 React-through-compat setup and useReactTable are not the native v9 API. Keep features, columns, and fallback arrays stable across renders.

Table owns models and state. The application owns markup, CSS, interactions, and accessibility. Core-only tables use row.getAllCells(); visibility-aware methods need columnVisibilityFeature. Optional state and APIs require their features. Put row-model slots after their prerequisite features in tableFeatures().

Load by task

  • For repeated features, defaults, typed contexts, or component registries, read reusable app hooks.
  • For Query-backed data, server pages, sorting, filtering, or request keys, read TanStack Query integration.
  • For virtual rows, columns, dynamic measurement, or infinite scrolling, read TanStack Virtual integration.
  • For controlled state, tracked reads, or render subscriptions, read table state.
  • For feature registration, missing feature APIs, or processing ownership, run intent load @tanstack/table-core#table-features and read only references needed by the task.
  • For v8 code, read the migration checklist.

API discovery

Inspect node_modules/@tanstack/preact-table/dist/index.d.ts, then the exported adapter declarations for the installed version. Inspect optional core APIs under node_modules/@tanstack/table-core/dist/features/.

よくある質問

まず中核のTanStack Tableのガイドを読む必要がありますか?

基本的なモデルと安定した入力のルールについて、先に共有の中核のガイドを読むよう求めています。

ライブラリのReact版を使うべきですか?

いいえ、ネイティブのPreactのパッケージとPreactのフックを使うようスキルは述べています。

表のデータはどこに置くべきですか?

例では、useStateを使ってPreactの状態に置き、表に渡しています。

詳細

作者による元の説明

Create and render Table v9 with the preact adapter. Route reusable createTableHook components, Query and Virtual integration, and framework setup; use table-state for reactive ownership.

repo: TanStack/table

人気

GitHubのスター
29k
ランキング
#9820
ライセンス
MIT
更新日
2026/10/21

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル