Skip to Content
Documentation@suspensive/codemodsMigrate TanStack Query imports

Migrate TanStack Query imports

  • We recommend upgrading to @tanstack/react-query@5 when using @suspensive/react-query with @tanstack/react-query@4.
  • Starting from @suspensive/react-query-4@3.3.0, queryOptions, infiniteQueryOption, useSuspenseQuery, and useSuspenseQueries have been deprecated. (@tanstack/react-query@4.40.0 officially supports useSuspenseQuery and queryOptions.)

Any API in @suspensive/react-query that is officially provided by @tanstack/react-query will be marked as deprecated.
This is because @suspensive/react-query offers the same APIs such as Suspense Hooks and queryOptions/infiniteQueryOption, and we want to encourage developers to use the official @tanstack/react-query APIs first.

Terminal
npx @suspensive/codemods tanstack-query-import .

This codemod automatically transforms import paths from @suspensive/react-query to @tanstack/react-query.

For example:

import { queryOptions } from '@suspensive/react-query' import { useSuspenseQuery } from '@suspensive/react-query-5' // The versioned package is also transformed!

Transforms into:

import { queryOptions } from '@tanstack/react-query' import { useSuspenseQuery } from '@tanstack/react-query'
Last updated on