Zum Inhalt springen
Skillpedia
Websites & UI (Frontend)29k · #9826

table-state

Was er macht

Dieser Skill erklärt, wie du Tabelleneinstellungen wie die aktuelle Seite im React-Status hältst und wie die Tabelle sie liest. Er ist für React-Entwickler gedacht, deren Ansicht zum Tabellenstatus passen muss.

Wann du ihn nutzt

  • ✓Wenn eine React-Komponente die aktuelle Seite oder eine andere Tabelleneinstellung anzeigen muss.
  • ✓Wenn du eine Tabelleneinstellung aus deiner Komponente an die Tabelle weitergeben musst.
  • ✓Wenn sich die React-Ansicht nach einer Änderung der Tabelleneinstellung nicht aktualisiert.

Link zum Skill

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

Kopiere ihn und füge ihn in deine KI ein (Claude, ChatGPT oder Cursor) mit der Bitte, den Anweisungen zu folgen.

So nutzt du ihn

Am einfachsten: Kopiere die Nachricht und füge sie in deine KI ein. Sie liest den Skill und folgt den Anweisungen.

Fertige Nachricht zum Einfügen

Nutze diesen Skill, um mir zu helfen: https://github.com/TanStack/table/blob/main/packages/react-table/skills/table-state/SKILL.md Lies die SKILL.md unter diesem Link und folge ihren Anweisungen für meine Aufgabe.
Soll deine KI Skills wie diesen selbst finden?Installiere den kostenlosen Skillpedia-MCP: eine Zeile, und sie durchsucht vor jeder Aufgabe 15.000+ Skills.In 1 Minute installieren →

Beispielanfrage an deine KI

“Wie aktualisiere ich die Seitenzahl meiner React-Tabelle, nachdem ich auf den Weiter-Button geklickt habe?”

5 neue Skills pro Woche. 1 Minute Lesezeit.

So funktioniert es

Er zeigt, wie du die Einstellung mit einem React-State-Hook speicherst, sie mit einem passenden Update-Callback an die Tabelle übergibst und den ausgewählten Status liest, damit die Ansicht neu rendert.

Technischer Inhalt (originale SKILL.md)

Originaltext des Autors, auf Englisch, direkt von GitHub.

React table state

Before starting, run intent load @tanstack/table-core#table-state for shared ownership, initialization, updates, and resets. State repair does not require loading setup guidance.

Read reactive state

useTable selects all registered state by default. Its optional second-argument selector controls rerenders and the shape of table.state. table.atoms.<slice>.get() and table.store.state are current snapshots, not React subscriptions.

Use selected table.state in the owner render. For narrower boundaries, use table.Subscribe or useSelector from @tanstack/react-store. Without source, table.Subscribe selects from table.store; with source, it subscribes to that atom or store. Start with the default selector until render cost requires narrowing.

Control a slice

Keep features, columns, and data stable. Register the feature that owns the controlled slice. This example controls pagination without adding client row processing:

import { useState } from 'react'
import {
  rowPaginationFeature,
  tableFeatures,
  useTable,
  type PaginationState,
} from '@tanstack/react-table'

const features = tableFeatures({ rowPaginationFeature })
const columns = [{ accessorKey: 'name' }]
const data = [{ name: 'Ada' }]

export function PageControl() {
  const [pagination, setPagination] = useState<PaginationState>({
    pageIndex: 0,
    pageSize: 20,
  })
  const table = useTable({
    features,
    columns,
    data,
    state: { pagination },
    onPaginationChange: setPagination,
  })
  return (
    <button onClick={() => table.setPageSize(50)}>
      {table.state.pagination.pageSize} rows per page
    </button>
  )
}

The React setter accepts both a value and a functional updater. Supply the current state.pagination together with onPaginationChange; a callback alone does not keep the table synchronized.

For an externally owned atom, create it with useCreateAtom from @tanstack/react-store, pass it in atoms.<slice>, and subscribe with useSelector where other UI needs its value.

Reactive boundaries

For React Compiler memoized children, put Subscribe inside the component hiding builder-method reads or pass the selected value as a changing prop. An outer subscription that ignores its value cannot refresh a stable child. In core-typed cell/header contexts, import standalone Subscribe.

For external-atom examples, selector dependencies, or fine-grained boundaries and React Compiler problems, read reactivity details. If this task changes processing features, run intent load @tanstack/table-core#table-features and read the relevant feature references.

API discovery

Inspect node_modules/@tanstack/react-table/dist/useTable.d.ts and Subscribe.d.ts, plus the installed @tanstack/react-store declarations for atom hooks.

Häufige Fragen

Warum wirkt ein Wert im Event-Handler veraltet?

Werte in Handlern sind Momentaufnahmen. Die Ansicht aktualisiert sich nur über ausgewählten Status oder ein Abo.

Brauche ich sowohl den Wert als auch den Callback?

Ja. Der Skill sagt, jeden kontrollierten Wert mit seinem Update-Callback zu übergeben, damit Änderungen korrekt zurückfließen.

Kann ich einschränken, was neu rendert?

Ja. Es gibt schmalere Abos, der Skill empfiehlt aber den Standard, bis die Render-Kosten eine Einschränkung erfordern.

Details

Originalbeschreibung des Autors

Read and control Table v9 state in react. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.

repo: TanStack/table

Beliebtheit

GitHub-Sterne
29k
Platz im Ranking
#9826
Lizenz
MIT
Aktualisiert
21.10.2026

Ist dieser Skill nützlich?

0

Anmelden um abzustimmen.

Kommentare

  • …

Weitere Skills aus diesem Repository

Ähnliche Skills