본문으로 건너뛰기
Skillpedia
웹사이트 및 UI (프런트엔드)29k · #9806

table-state

하는 일

이 스킬은 어떤 페이지가 표시되는지 같은 표의 설정을 추적하고, Alpine.js 페이지에서 그것을 업데이트하는 방법을 설명합니다. 표와 나머지 페이지가 함께 맞춰져야 하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓표의 현재 페이지나 다른 설정을 버튼이나 라벨에 보여 줘야 할 때.
  • ✓표 상태의 일부를 내 코드에서 제어하고 싶을 때.
  • ✓상태가 바뀐 뒤에도 표가 화면에서 업데이트되지 않는 경우.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/TanStack/table/blob/main/packages/alpine-table/skills/table-state/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“Alpine.js 표에서 다음 버튼을 눌러도 페이지 번호가 바뀌지 않아요. 어떻게 고치나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

getter와 콜백으로 제어되는 상태를 전달하는 방법을 보여 줍니다. 그렇게 하면 Alpine이 최신 값을 읽고, 값이 바뀔 때 화면이 업데이트됩니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Load intent load @tanstack/table-core#table-state first for shared ownership, initialization, updater, and reset rules.

Alpine's table proxy makes reads inside x-text, x-for, x-if, bound attributes, x-effect, and Alpine getters reactive. Event handlers read the current value when invoked. A captured value outside a binding does not become a continuing subscription, and there is no table.Subscribe component.

Controlled getter setup

<!-- skill-snippet:check -->
import Alpine from 'alpinejs'
import {
  createTable,
  rowPaginationFeature,
  tableFeatures,
  type PaginationState,
} from '@tanstack/alpine-table'

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

Alpine.data('pagedTable', () => {
  const local = Alpine.reactive<{ pagination: PaginationState }>({
    pagination: { pageIndex: 0, pageSize: 10 },
  })
  const table = createTable({
    features,
    columns,
    data,
    state: {
      get pagination() {
        return local.pagination
      },
    },
    onPaginationChange: (next) => {
      local.pagination =
        typeof next === 'function' ? next(local.pagination) : next
    },
  })
  return { table }
})

Read table.atoms.pagination.get().pageIndex directly in an Alpine binding.

Reactive boundaries

  • A controlled slice needs a getter and callback. state: { pagination: local.pagination } captures the old object when the owner later replaces it.
  • Expose changing data through get data() and keep features, columns, and derived data stable outside reevaluated getters.
  • The proxy normally reevaluates all Table-reading bindings for every state change. A narrow atom read does not by itself narrow that broad invalidation.
  • For shared state, pass a stable external atom through atoms; omit controlled state and its callback for the same slice.

Read for the task

For advanced reactive boundaries, shared atoms, or detailed subscription examples, read reactivity. For construction or rendering setup, read getting-started.

API discovery

Inspect node_modules/@tanstack/alpine-table/dist/index.d.ts, createTable.d.ts, and reactivity.d.ts. Core feature APIs are in node_modules/@tanstack/table-core/dist/features/.

자주 묻는 질문

상태가 바뀌어도 표가 새로 고쳐지지 않는 이유는 무엇인가요?

데이터나 상태를 getter로 읽지 않고 한 번 복사했기 때문에, Alpine이 나중의 변경을 볼 수 없는 경우가 많습니다.

클릭 핸들러 안에서 값을 한 번 읽을 수 있나요?

네, 이벤트 핸들러는 실행되는 순간의 현재 값을 읽습니다.

핵심 표 가이드를 대체하나요?

아니요, 핵심 가이드의 공유 소유권과 초기화 규칙 위에 Alpine 전용 규칙을 더합니다.

상세 정보

작성자의 원본 설명

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

repo: TanStack/table

인기도

GitHub 스타
29k
순위
#9806
라이선스
MIT
업데이트
2026. 10. 21.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬