Skip to content
Home / Migrations / TanStack Query v4TanStack Query v5

TanStack Query v4 TanStack Query v5

medium

v5 simplifies the API — one query signature, no overloads. Minor breaking changes but the codemod handles 80% of the migration.

Estimated: 2-4h · 5 steps
Progress0%
Step 1: Update package
npm install @tanstack/react-query@5 && npm install -D @tanstack/eslint-plugin-query
Step 2: Run the codemod

Handles the signature changes automatically.

npx jscodeshift -t node_modules/@tanstack/react-query/build/codemods/v5/remove-overloads/remove-overloads.cjs src/
Step 3: Fix removed features

isLoading removed for disabled queries — use isPending. onSuccess/onError callbacks removed from useQuery — use useEffect or mutation callbacks.

Step 4: Update TypeScript types

Some generic type positions changed. Check components using QueryObserverResult types directly.

Step 5: Verify
All queries and mutations work. No TypeScript errors. DevTools show expected query states.

What this migration involves

Moving from TanStack Query v4 to TanStack Query v5 is rated medium and takes about 2-4h on a typical project. The guide breaks it into 5 steps, 2 of which ship with runnable commands and 1 with a verification check.

FAQ

How long does migrating from TanStack Query v4 to TanStack Query v5 take?

Around 2-4h for a typical project — 5 steps, difficulty rated medium, 2 of them with copy-paste commands.

Is moving from TanStack Query v4 to TanStack Query v5 reversible?

No reverse guide is tracked yet, so treat this as a one-way move and keep a full export of your TanStack Query v4 data before you start.

What does TanStack Query v5 cost compared to TanStack Query v4?

Pricing for both tools is contact-based or not tracked yet.