Capítulo 54 de 54

Chapter 54: Legacy API (v8 Compatibility)

Core Idea

Every export under @tanstack/react-table/legacy is deprecated on arrival — it exists solely so a v8 codebase can upgrade its dependency without a big-bang rewrite, via useLegacyTable (see the dedicated guide chapter). Nothing here should appear in new code.

Reference Tables

ExportRole
useLegacyTable()v8-shaped useReactTable replacement, running on v9 internals
legacyCreateColumnHelper()v8-shaped createColumnHelper (.accessor, .display)
getCoreRowModel() / getFilteredRowModel() / getSortedRowModel() / getGroupedRowModel() / getExpandedRowModel() / getPaginationRowModel()v8-shaped row-model getters, passed directly as table options instead of registered via tableFeatures()
getFacetedRowModel() / getFacetedMinMaxValues() / getFacetedUniqueValues()v8-shaped faceting row-model getters
LegacyRowModelOptions<TData>options shape accepted by the legacy row-model getters
LegacyTable<TData> / LegacyTableOptions<TData> / LegacyReactTable<TData>v8-shaped table instance/options/hook-return types
LegacyColumnDef<TData, TValue>v8-shaped column definition type
LegacyFeaturesthe fixed "everything on" feature set useLegacyTable runs with internally
RowModelFactory / FacetedRowModelFactory / FacetedMinMaxValuesFactory / FacetedUniqueValuesFactorythe factory-function type signatures behind the get*RowModel legacy functions

Key Concepts

  • Import boundary: legacy functions/types come from the separate @tanstack/react-table/legacy entrypoint — core exports (flexRender, shared state types) still come from @tanstack/react-table itself. Mixing up which entrypoint an import comes from is the most common setup mistake (see the useLegacyTable chapter).
  • No tree-shaking: LegacyFeatures bundles every built-in feature unconditionally — useLegacyTable cannot opt into a smaller bundle the way tableFeatures({...}) can.
  • v8-shaped row models as options, not registrations: legacy get*RowModel() functions are passed directly as table options (getCoreRowModel: getCoreRowModel(), etc.), exactly matching v8's API — not registered inside tableFeatures().
  • Every symbol in this namespace is marked deprecated in its own type signature (strikethrough in the source docs) — this is a compatibility shim with a clear migration target (useTable + tableFeatures), not a parallel long-term API surface.

Key Takeaways

  1. Treat every export here as "temporary" — the goal is always to migrate each table off useLegacyTable toward useTable, one table at a time.
  2. LegacyFeatures' all-features-on bundle is the concrete cost of using this compatibility layer — budget for it accordingly if migrating a large app incrementally.
  3. Double-check import paths (@tanstack/react-table vs. @tanstack/react-table/legacy) whenever mixing legacy and current-API tables in the same codebase during a migration.

Connects To

  • Using useLegacyTable for Incremental Migration: full practical usage of this entire namespace.
  • Migrating to TanStack Table V9 (React): the complete list of what changes when leaving this compatibility layer behind.