substitutefor

Contribute to the catalog

Improve SWR

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.

  • tanstack-query — Fetching, refreshing and mutating server-backed data in React 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 · SWR license

Source 1

Source details

To remove this source, first uncheck its citations.

Source 2 · SWR getting started

Source 2

Source details

To remove this source, first uncheck its citations.

Source 3 · SWR arguments

Source 3

Source details

To remove this source, first uncheck its citations.

Source 4 · SWR automatic revalidation

Source 4

Source details

To remove this source, first uncheck its citations.

Source 5 · SWR error handling

Source 5

Source details

To remove this source, first uncheck its citations.

Source 6 · SWR cache providers

Source 6

Source details

To remove this source, first uncheck its citations.

Source 7 · SWR mutation and revalidation

Source 7

Source details

To remove this source, first uncheck its citations.

Source 8 · TanStack Query overview

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 · Separating fetching from cache behavior

Section 1

Sources for paragraph 1
2 · Keys must describe the changing request

Section 2

Sources for paragraph 1
3 · Refresh policy and request volume

Section 3

Sources for paragraph 1
4 · Stale data can coexist with an error

Section 4

Sources for paragraph 1
5 · Custom caches change mutation scope

Section 5

Sources for paragraph 1
6 · Optimistic updates are provisional

Section 6

Sources for paragraph 1
7 · License and substitution

Section 7

Linked to tanstack-query. 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

SWR

MIT-licensed React data-fetching library with shared caching, revalidation and mutation helpers.

Overview

SWR is an open-source React library for data fetching and caching. A component supplies a key and a fetcher, while SWR coordinates cached data and refresh behavior. Mutation helpers support updating the interface around remote writes. It supplies client data-state machinery, not a backend or proof that an optimistic UI change has been saved.[2][6][7]

Separating fetching from cache behavior

SWR accepts application-defined fetcher logic, with the introductory guide showing a native fetch wrapper and alternatives for other request clients. This lets the same hook pattern work with different APIs. The application still owns transport details and how a response becomes useful data; the library does not discover an API's business rules merely from a URL.[2]

Keys must describe the changing request

The arguments guide warns that a request using changing authorization context while retaining a fixed key can return the wrong cached data. The key must capture the dependencies that distinguish results. It also documents changed array-argument behavior between older versions and version 2 onward. Existing fetcher signatures and context-sensitive keys should therefore be reviewed together when migrating generated or older code.[3]

Refresh policy and request volume

SWR revalidates on window focus and network reconnection by default. Timed refreshing is optional, with hidden and offline refresh controls disabled by default. An immutable-resource helper disables automatic revalidation for data that really should not change. As an assessment, these settings should match the resource and service limits; disabling refresh for changing account data is a behavior change, not simply a harmless optimization.[4]

Stale data can coexist with an error

A fetcher rejection produces an error state. The error-handling guide explicitly checks non-success HTTP statuses and throws rather than assuming valid JSON means success. It also notes that data and error can be present simultaneously, allowing the UI to retain an existing result while reporting a failed refresh. Retry behavior is configurable. A generated component needs to decide how that stale-but-visible state should look.[5]

Custom caches change mutation scope

The default shared cache can be replaced with a Map-like provider under SWRConfig. Hooks inside that boundary use that provider, and the globally imported mutate does not operate on them in the same way. The documentation points to useSWRConfig for the relevant scoped mutator and discourages direct cache writes. Remounting a provider can also recreate its cache, so its placement affects more than code organization.[6]

Optimistic updates are provisional

Mutation helpers can display optimistic data, populate the cache from a response and restore prior local data when a remote operation fails. That rollback changes the local cache; it does not establish reversal of a completed server operation. The guide also warns that calling a global mutator with only a key does not revalidate or update the cache unless a matching hook is mounted. These are important boundaries for generated save buttons and background update flows.[7]

License and substitution

SWR uses MIT terms. It can replace TanStack Query for suitable React server-data workflows if the application migrates its keys, fetchers, cache boundaries and refresh policy. This comparison does not establish API compatibility or replace the backend's persistence and authorization rules. No installation, performance test or application migration was performed.[1][2][6][8]

References

  1. SWR license

    MIT terms

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

    React key/fetcher setup

    vendor · retrieved 2026-10-07
  3. SWR arguments

    Entire key identity and changed fetcher context

    vendor · retrieved 2026-10-07
  4. SWR automatic revalidation

    Focus/reconnect defaults, intervals and immutable resources

    vendor · retrieved 2026-10-07
  5. SWR error handling

    Fetcher rejection, HTTP status checks and data/error coexistence

    vendor · retrieved 2026-10-07
  6. SWR cache providers

    Provider boundaries and global mutate limitations

    vendor · retrieved 2026-10-07
  7. SWR mutation and revalidation

    Mounted-hook requirement, optimisticData, rollbackOnError and populateCache

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

    Server-state caching and query functions

    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.