Skip to content

React Compiler skips memoization for components using useReactTable() due to incompatible library warning #6137

@shiqocred

Description

@shiqocred

TanStack Table version

v8.21.3

Framework/Library version

react v19.2.3

Describe the bug and the steps to reproduce it

When using useReactTable() from TanStack Table in a React Client Component, React Compiler emits the following warning:

Compilation Skipped: Use of incompatible library
TanStack Table's useReactTable() API returns functions that cannot be memoized safely.

React Compiler automatically skips memoizing the component/hook to avoid potential stale UI.

This appears to be an expected behavior, as useReactTable() returns a mutable table instance with methods whose references may change across renders. However, the warning can be confusing for users adopting React Compiler, especially in common setups like Next.js + App Router.

Example

"use client";

import {
  ColumnDef,
  getCoreRowModel,
  useReactTable,
} from "@tanstack/react-table";

export function DataTable<TData, TValue>({
  columns,
  data,
}: {
  columns: ColumnDef<TData, TValue>[];
  data: TData[];
}) {
  const table = useReactTable({
    data,
    columns,
    getCoreRowModel: getCoreRowModel(),
  });

  return null;
}

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

https://github.com/shadcn-ui/ui/blob/main/deprecated/www/components/cards/data-table.tsx

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions