substitutefor

Contribute to the catalog

Improve TanStack Query

Help someone find the right substitute. Share what you know, explain its limits, and show your sources.

Keep useful details and sources from the current draft as you make your changes.

Sign in or create an account ↗ to earn credit. You can also submit anonymously and save a private receipt. Contributions go to review before publication.

Your own projects are welcome, and an AI assistant can contribute on your behalf. Describe the project accurately and cite sources. You can submit immediately; no minimum karma or prior reviews are required.

1

Identify the subject

Which product or service are you writing about?

This entry can substitute forOptional

Choose the product this entry can replace. For example, when editing GIMP, choose Photoshop to describe GIMP as a substitute for Photoshop. Use “unknown” if the evidence does not show whether the task is supported; “unsupported” means the evidence shows it cannot do the task.

0 of 200 substitute relationships.

Draft comparisons

These comparisons link to articles by their planned address. Edit them under Structured data.

  • swr — Fetching and caching server data in application interfaces
2

Write & cite

Help readers understand what it does and where it falls short.

Article sections and citations
Sources for the overview

Sources

Reuse throughout the article

Add each source once. Select it under the paragraphs it supports.

Source 1 · TanStack Query license

Source 1

Source details

To remove this source, first uncheck its citations.

Source 2 · TanStack Query overview

Source 2

Source details

To remove this source, first uncheck its citations.

Source 3 · TanStack Query defaults

Source 3

Source details

To remove this source, first uncheck its citations.

Source 4 · TanStack query keys

Source 4

Source details

To remove this source, first uncheck its citations.

Source 5 · TanStack query functions

Source 5

Source details

To remove this source, first uncheck its citations.

Source 6 · TanStack query cancellation

Source 6

Source details

To remove this source, first uncheck its citations.

Source 7 · TanStack server rendering

Source 7

Source details

To remove this source, first uncheck its citations.

Source 8 · SWR getting started

Source 8

Source details

To remove this source, first uncheck its citations.

Article sections

Explain uses, limitations, or compatibility. Give each paragraph the sources that support it.

1 · Server state rather than every application state

Section 1

Sources for paragraph 1
2 · Cache identity is part of correctness

Section 2

Sources for paragraph 1
3 · Freshness and retention are different settings

Section 3

Sources for paragraph 1
4 · The query function defines failure

Section 4

Sources for paragraph 1
5 · Cancellation needs transport cooperation

Section 5

Sources for paragraph 1
6 · Server rendering and data separation

Section 6

Sources for paragraph 1
7 · License and substitution

Section 7

Linked to swr. Keep surrounding spaces so the text reads naturally.

Sources for paragraph 1
Structured data Advanced

For agents and detailed edits, including links within paragraphs. Follow the article schema, or use the API. Applying JSON replaces the body, references, article address, and draft comparisons shown here.

Include up to 200 draft comparisons, preserving the existing sources and relationships when adding more.

3

Add useful details Optional

Add what you know. You can submit without filling these in.

Capabilities5

Describe a task this product can perform, its limits, and the evidence. Use “unknown” if the evidence does not show whether the task is supported; “unsupported” means the evidence shows it cannot do the task.

Help readers find related options Optional

Have a useful detail to add? Choose a question, give a short answer, and reuse an article source. Skip this section if you prefer.

Which article sources support this answer?
Only saved answers are included. A blank section is fine.
Screenshots Optional

Show the website or a useful part of its interface. Add up to three still PNG, JPEG or WebP images, each up to 5 MiB. Screenshot guidelines ↗

Crop to the relevant screen. Remove personal information, credentials, account balances and private messages. Images keep their stated rights; they are not automatically CC0.

Sign in to upload screenshots. You can submit the article without them.

License, other names & status
Sources for the license or business model
4

Check & submit

Give reviewers a clear summary and a source they can check.

Preview your article

TanStack Query

Open-source server-state library for fetching, caching and synchronizing asynchronous data with configurable query lifecycles.

Overview

TanStack Query, formerly React Query, is an open-source library for managing asynchronous server state in application interfaces. It tracks fetched data, loading and error states and cache lifecycles around application-supplied query functions. It can replace repeated fetching and synchronization code, but it does not supply the backend or make cached data automatically authoritative.[2][5]

Server state rather than every application state

The library addresses data obtained asynchronously from another system, where the displayed copy can become stale independently of local UI actions. A QueryClient and provider coordinate the React integration, while query functions perform the actual work. This separates cache and request lifecycle handling from the backend transport. It should not be read as a replacement for authentication, a database or all local component state.[2]

Cache identity is part of correctness

Query keys identify the data being fetched and act as dependencies. The guide says to include changing variables used by the query function, such as the selected record or filter. Object-property order is normalized in hashing, while array order matters. A generated interface that changes its request parameters without changing its key can therefore have the wrong cache identity even when the request function looks correct.[4]

Freshness and retention are different settings

Cached data is stale by default, and stale queries may refetch on mounting, window focus or reconnection. staleTime changes that freshness behavior; inactive-cache retention is controlled separately by gcTime. The documented defaults include five-minute inactive retention and retry behavior. Infinity still permits manual invalidation, whereas static blocks invalidation-triggered refetches. These distinctions should be chosen for the resource rather than used as interchangeable ways to silence network activity.[3]

The query function defines failure

A successful query must resolve data other than undefined; null can represent an intentionally empty result. To enter the error state, its function must throw or return a rejected promise. Native fetch does not throw simply because an HTTP response is unsuccessful, so the guide checks the status and throws explicitly. This boundary is useful when reviewing generated fetchers that otherwise parse an error response as successful data.[5]

Cancellation needs transport cooperation

TanStack Query supplies an AbortSignal to the query function, but an unused query's in-flight promise is not cancelled by default merely because its component unmounts. Passing the signal to a supported transport allows actual cancellation and restores prior query state. The documentation excludes the Suspense query hooks from this cancellation behavior. A cancel button should therefore be checked against the chosen hook and transport, not inferred from the presence of a library method.[6]

Server rendering and data separation

The SSR guide describes prefetching, serializing the cache and hydrating it on the client. It warns against a file-level shared QueryClient that would mix data across server requests and users. Request-scoped cache creation is consequently a privacy and correctness requirement in that setup, not just a performance preference. The article does not claim a particular application's hydration or user isolation has been tested.[7]

License and substitution

TanStack Query is MIT-licensed. It can replace SWR for suitable React data-fetching and caching workflows, with an explicit migration of keys, request functions and refresh policy. No drop-in API compatibility, benchmark or tested application migration is claimed. Applications still need their own decisions about invalidation and backend success.[1][2][5][8]

References

  1. TanStack Query license

    MIT terms

    vendor · retrieved 2026-10-07
  2. TanStack Query overview

    Server state and basic React query workflow

    vendor · retrieved 2026-10-07
  3. TanStack Query defaults

    Staleness, refetching, static/Infinity and garbage collection

    vendor · retrieved 2026-10-07
  4. TanStack query keys

    Changing query dependencies belong in keys

    vendor · retrieved 2026-10-07
  5. TanStack query functions

    Rejected promises, undefined and fetch status handling

    vendor · retrieved 2026-10-07
  6. TanStack query cancellation

    AbortSignal consumption and Suspense limitations

    vendor · retrieved 2026-10-07
  7. TanStack server rendering

    Request-scoped QueryClient and hydration

    vendor · retrieved 2026-10-07
  8. SWR getting started

    Key/fetcher and React data-fetching hook

    vendor · retrieved 2026-10-07

Also included: 5 capabilities and 0 substitute relationships. Check substitutes in section 1 and capabilities in section 3.

Contribution type

Agree to CC0 above to submit your contribution.