table-state
하는 일
이 스킬은 Preact 컴포넌트에서 현재 페이지 같은 표 설정을 보관하고, 표가 그것을 읽는 방법을 설명합니다. 뷰가 표 상태와 맞아야 하는 Preact 개발자를 위한 스킬입니다.
사용하는 경우
- ✓Preact 컴포넌트가 현재 페이지나 다른 표 설정을 보여 줘야 할 때.
- ✓컴포넌트의 표 설정을 표에 넘겨야 할 때.
- ✓표 설정이 바뀌었는데 Preact 뷰가 업데이트되지 않는 경우.
스킬 링크
https://github.com/TanStack/table/blob/main/packages/preact-table/skills/table-state/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“다음 페이지 버튼을 클릭한 뒤 Preact 표의 페이지 번호를 어떻게 업데이트하나요?”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
상태 훅으로 설정을 보관하고, 일치하는 업데이트 콜백과 함께 표에 넘기고, 선택된 상태를 읽어 뷰가 다시 렌더링되게 하는 방법을 보여 줍니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Preact 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 Preact subscriptions.
Use selected table.state in the owner render. For narrower boundaries, use table.Subscribe or useSelector from @tanstack/preact-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 'preact/hooks'
import {
rowPaginationFeature,
tableFeatures,
useTable,
type PaginationState,
} from '@tanstack/preact-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 Preact 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/preact-store, pass it in atoms.<slice>, and subscribe with useSelector where other UI needs its value.
Reactive boundaries
Use native @tanstack/preact-store bindings. A narrowed selector must include every state slice used by rendered builder methods, or those consumers need their own subscription.
For external-atom examples, selector dependencies, or fine-grained boundaries, 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/preact-table/dist/useTable.d.ts and Subscribe.d.ts, plus the installed @tanstack/preact-store declarations for atom hooks.
자주 묻는 질문
클릭 핸들러 안에서 값을 읽으면 뷰가 왜 새로 고쳐지지 않나요?
핸들러에서 읽은 값은 그 순간의 스냅샷이므로, 뷰는 선택된 상태나 구독에서만 새로 고쳐집니다.
값과 함께 콜백도 넘겨야 하나요?
네, 변경이 컴포넌트로 되돌아오도록 각 제어 값을 그 콜백과 짝지으라고 이 스킬은 설명합니다.
표의 일부만 다시 렌더링되게 할 수 있나요?
네, 가이드는 더 좁은 구독을 설명하지만, 렌더링 비용이 커질 때까지는 기본값을 권합니다.
상세 정보
작성자의 원본 설명
Read and control Table v9 state in preact. Use for tracked reads, subscriptions, controlled slices, and framework-specific reactive boundaries.
repo: TanStack/table
인기도
- GitHub 스타
- 29k
- 순위
- #9822
- 라이선스
- MIT
- 업데이트
- 2026. 10. 21.
댓글
- …
이 저장소의 다른 스킬
getting-started
29k에이전트가 Alpine.js에서 TanStack Table로 데이터 표를 만들고 표시하는 방법을 가르칩니다. 설정, 반응형 데이터, 행 렌더링을 다룹니다.
table-state
29k에이전트가 Alpine.js에서 현재 페이지 같은 표의 상태를 읽고 제어하도록 가르칩니다. 상태가 바뀌면 화면도 함께 업데이트됩니다.
devtools
29k에이전트가 Angular 표를 TanStack Devtools 패널에 등록하는 방법을 가르칩니다. 개발자가 앱을 만드는 동안 각 표를 점검할 수 있게 합니다.
getting-started
29k에이전트가 Angular에서 TanStack 표를 만들고 표시하는 방법을 가르칩니다. injectTable 설정, 템플릿 렌더링, 행 데이터 업데이트를 다룹니다.
비슷한 스킬
angular-developer
280k에이전트가 Angular 코드를 만들고 프로젝트 구조를 조언하도록 돕습니다. 새 프로젝트 시작, 코드 부분 생성, 성능과 접근성 개선에 유용합니다.
frontend-a11y
280k모든 사람이 웹 인터페이스를 쓸 수 있도록 에이전트를 돕습니다. 웹사이트와 앱이 화면 읽기 프로그램과 키보드 탐색에서 잘 작동하도록 합니다.
frontend-patterns
280k프론트엔드 개발의 현대적인 패턴을 적용하도록 에이전트를 돕습니다. React와 Next.js에서 성능을 최적화하고, 상태를 관리하며, 모범 사례를 따릅니다.