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.