Frontend & UISûr100100/100
With Tanstack Query (TanStack) — React Table
Compose React Table v9 with TanStack Query for server filtering, sorting, pagination, and infinite data. Load for query-key table state, manual* processing boundaries, server rowCount, keepPreviousData, or avoiding duplicated query-result state.
ou envoie-le directement à ton agent.
Installer dans ton projet
$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs with-tanstack-query__tanstack-table__packages-react-table-skills-d297c5993fb2TanStack
TanStack/table
Contenu à copier
---
name: with-tanstack-query
description: >
Compose React Table v9 with TanStack Query for server filtering, sorting, pagination, and infinite data. Load for query-key table state, manual* processing boundaries, server rowCount, keepPreviousData, or avoiding duplicated query-result state.
metadata:
origin: TanStack
type: composition
library: '@tanstack/react-table'
library_version: '9.2.4'
framework: react
requires:
- '@tanstack/table-core#client-vs-server'
- getting-started
- table-state
sources:
- 'TanStack/table:examples/react/with-tanstack-query'
- 'TanStack/table:examples/react/virtualized-infinite-scrolling'
- 'TanStack/table:docs/framework/react/guide/pagination.md'
---
This skill builds on `@tanstack/table-core#client-vs-server`, `getting-started`, and `table-state`. Query owns fetching/cache; Table owns grid state and receives rows already processed by every manual server stage.
## Setup
```tsx
import { keepPreviousData, useQuery } from '@tanstack/react-query'
import { useCreateAtom, useSelector } from '@tanstack/react-store'
import {
rowPaginationFeature,
tableFeatures,
useTable,
} from '@tanstack/react-table'
import type { PaginationState } from '@tanstack/react-table'
const features = tableFeatures({ rowPaginationFeature })
const emptyRows: Array<{ id: string }> = []
function ServerTable() {
const paginationAtom = useCreateAtom<PaginationState>({
pageIndex: 0,
pageSize: 20,
})
const pagination = useSelector(paginationAtom, (value) => value)
const result = useQuery({
queryKey: ['people', pagination],
queryFn: async () =>
fetch(
`/api/people?page=${pagination.pageIndex}&size=${pagination.pageSize}`,
).then(
(r) =>
r.json() as Promise<{
rows: Array<{ id: string }>
rowCount: number
}>,
),
placeholderData: keepPreviousData,
})
return useTable({
features,
columns,
data: result.data?.rows ?? emptyRows,
rowCount: result.data?.rowCount,
atoms: { pagination: paginationAtom },
manualPagination: true,
})
}
```
## Core Patterns
### Put every server-owned slice in the key
```tsx
const result = useQuery({
queryKey: ['people', pagination, sorting, columnFilters],
queryFn: () => fetchPeople({ pagination, sorting, columnFilters }),
})
```
### Feed the query result directly to Table
```tsx
const table = useTable({
features,
columns,
data: result.data?.rows ?? emptyRows,
})
```
## Common Mistakes
### HIGH Duplicating query rows into state
Wrong:
```tsx
useEffect(() => setRows(result.data?.rows ?? []), [result.data])
const table = useTable({ features, columns, data: rows })
```
Correct:
```tsx
const table = useTable({
features,
columns,
data: result.data?.rows ?? emptyRows,
})
```
The second state layer can lag behind the query cache and creates an extra synchronization path.
Source: `examples/react/with-tanstack-query`
### HIGH Omitting state from the query key
Wrong:
```tsx
useQuery({ queryKey: ['people'], queryFn: () => fetchPeople({ pagination }) })
```
Correct:
```tsx
useQuery({
queryKey: ['people', pagination],
queryFn: () => fetchPeople({ pagination }),
})
```
Query otherwise reuses cache entries for different server requests.
Source: `examples/react/with-tanstack-query`
### HIGH Expecting manual mode to fetch
Wrong:
```tsx
useTable({ features, columns, data, manualPagination: true })
```
Correct:
```tsx
useTable({
features,
columns,
data: result.data?.rows ?? emptyRows,
rowCount: result.data?.rowCount,
manualPagination: true,
})
```
`manualPagination` only bypasses client pagination; the application must fetch a processed page and provide its total count.
Source: `docs/framework/react/guide/pagination.md`
### MEDIUM Flashing an empty page during fetch
Wrong:
```tsx
useQuery({
queryKey: ['people', pagination],
queryFn: () => fetchPeople({ pagination }),
})
```
Correct:
```tsx
useQuery({
queryKey: ['people', pagination],
queryFn: () => fetchPeople({ pagination }),
placeholderData: keepPreviousData,
})
```
Preserve the previous page intentionally when an empty loading transition is undesirable.
Source: `examples/react/with-tanstack-query`
## API Discovery
Inspect `node_modules/@tanstack/react-table/dist/index.d.ts` and the relevant core feature source; inspect the installed `@tanstack/react-query` source for current query option types.Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.
Ce que fait With Tanstack Query (TanStack) — React Table
Applique les pratiques du skill with-tanstack-query__tanstack-table__packages-react-table-skills-d297c5993fb2.
Comment utiliser With Tanstack Query (TanStack) — React Table
1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.
Déclencheurs pour With Tanstack Query (TanStack) — React Table
Dis simplement à ton agent quelque chose comme :
Applique le skill with-tanstack-query__tanstack-table__packages-react-table-skills-d297c5993fb2 à cette tâche
Utilise with-tanstack-query__tanstack-table__packages-react-table-skills-d297c5993fb2 pour améliorer cette implémentation
Passe en revue ce sujet avec with-tanstack-query__tanstack-table__packages-react-table-skills-d297c5993fb2
Skills liés à With Tanstack Query (TanStack) — React Table
accessibility
Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels, accessibility traits and hints, focus management, contrast, target size, and screen-reader support. Use when building or auditing UI for accessibility compliance, keyboard navigation, or screen-reader support.Accessibility Pass (Microsoft)
Use this skill whenever the user asks to check, review, or fix the accessibility of a PowerPoint deck, Word document, HTML page, or Markdown file, and before handing over any deck or document this agent just generated, so it does not ship with missing alt text, untitled slides, or unreadable colour contrast.Add Connector (Microsoft)
Use when adding a Power Platform connector to an Expo/React Native Power Apps mobile app and no dedicated mobile connector skill exists.