react/compose-with-tanstack-store

Compose TanStack Table with TanStack Store to manage table state slices externally.

28.3k|3.6k|Updated Oct 20, 2016
One-click install
npx skills add https://github.com/TanStack/table --skill react-compose-with-tanstack-store
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react/compose-with-tanstack-store
Source: https://github.com/TanStack/table/tree/main/packages/react-table/skills/react/compose-with-tanstack-store
Command: npx skills add https://github.com/TanStack/table --skill react-compose-with-tanstack-store

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Table state ownership is difficult when you need sharing, persistence, or fine-grained subscriptions across components and even across multiple tables without wiring many onChange callbacks.

Core Features & Use Cases

  • Own one or more table state slices externally (sorting, pagination, rowSelection, columnFilters, columnVisibility, etc.) to remove callback-based state plumbing.
  • Share slices across components and tables to enable global filters, coordinated UI state, and consistent behavior across data grids.
  • Persist slices outside the table render path (for example, saving column visibility or filters to localStorage).
  • Use narrow subscriptions for performance by reading only the atom(s) you care about via selector-based reads.

Quick Start

Ask the AI agent to show how to integrate @tanstack/react-store with useTable by providing a stable sorting atom through options.atoms so the table writes directly to your atom without any onSortingChange handler.

Frequently Asked Questions about react/compose-with-tanstack-store

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I share TanStack Table sorting and pagination state across multiple React components?

You can share TanStack Table state across components by composing the table with TanStack Store atoms. Providing these atoms through useTable options.atoms allows external state slices to be read and written without onChange callbacks.

What is the best way to manage React table state externally without prop drilling or callback handlers?

Managing React table state externally is best done using TanStack Store atoms. By wiring atom ownership via options.atoms, the table writes directly to your atoms, eliminating callback-based state plumbing for slices like sorting and filtering.

How does TanStack Store integrate with TanStack Table for fine-grained state subscriptions?

TanStack Store integrates with TanStack Table by using useCreateAtom to define state slices and useSelector for narrow reads. This fine-grained subscription model lets components subscribe only to specific table state slices like column visibility.

Can I persist TanStack Table column filters and visibility state to localStorage in React?

Yes, you can persist column filters and visibility state by owning those slices externally with TanStack Store. Because the table state lives outside the render path in atoms, you can easily save and restore the state from localStorage.

Does TanStack Table support coordinating row selection and filtering state across multiple data grids?

Yes, TanStack Table supports coordinated UI state across multiple data grids. By sharing state slices like row selection and column filters through TanStack Store atoms, multiple tables can maintain consistent behavior and synchronized state.