Stage 02 · Test · Researched comparison
Best React Data Fetching Libraries in 2026
TanStack Query is the first pick for most teams that need caching, background refetching and request deduplication without adopting a full framework. SWR suits smaller apps that want a light hook-based cache with a small API. RTK Query fits projects already built on Redux Toolkit. Teams using GraphQL should compare Apollo Client and urql before choosing.
By Shihab Mia
Published 27 Nov 2026 · 7 tools compared
We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.
Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.
Key takeaways
- TanStack Query, SWR, RTK Query and React Router loaders are free and open source; Apollo Client and urql are also open source with optional paid GraphQL platform services.
- Relay is open source but assumes a GraphQL server that follows the Relay specification, so it is a narrower fit than the others.
- All seven libraries run in the browser and in React Native; none of them sends your API data to a third-party service by default.
- Cache behavior, retry defaults and bundle size differ, so check the documentation for the version you plan to ship.
Who each pick is for
- REST and GraphQL apps that need a full async state cacheTanStack Query
- Small to mid-size apps that want a light data hookSWR
- Redux Toolkit projects that want built-in data fetchingRTK Query
- GraphQL apps that need a normalized client cacheApollo Client
- GraphQL apps that want a lightweight, extensible clienturql
- Large GraphQL apps built on the Relay specificationRelay
- Apps already on React Router that want route-level data loadingReact Router loaders
Comparison
| Tool | Best for | Standout feature | Listed starting price | Free plan or trial |
|---|---|---|---|---|
| 1TanStack Query | REST and GraphQL apps that need a full async state cache | Mature cache with background refetch and deduplication | Free (open source) | Free plan |
| 2SWR | Small to mid-size apps that want a light data hook | Small API built on stale-while-revalidate | Free (open source) | Free plan |
| 3RTK Query | Redux Toolkit projects that want built-in data fetching | Ships inside Redux Toolkit with generated hooks | Free (open source) | Free plan |
| 4Apollo Client | GraphQL apps that need a normalized client cache | Normalized cache and rich GraphQL tooling | Free (open source) | Free plan |
| 5urql | GraphQL apps that want a lightweight, extensible client | Small core with an exchange-based extension model | Free (open source) | Free plan |
| 6Relay | Large GraphQL apps built on the Relay specification | Compiler-driven queries with colocated fragments | Free (open source) | Free plan |
| 7React Router loaders | Apps already on React Router that want route-level data loading | Data loading tied to routes with no extra library | Free (open source) | Free plan |
How we picked
We compared libraries on fit for the job, supported platforms, license and price, whether data stays in your app or goes to a vendor service, and main limits such as GraphQL-only support or required server specs. Sources are vendor documentation, project repositories and public pricing pages. We did not run benchmarks. Prices and plan details change, so confirm them on the vendor site before you commit.
The tools, one by one
TanStack Query
Best for rEST and GraphQL apps that need a full async state cache

What it is and where it fits
TanStack Query (formerly React Query) manages server state: fetching, caching, synchronizing and updating. It works with any promise-based data source, so it fits REST, GraphQL and custom clients. The React package ships hooks such as useQuery and useMutation, plus devtools for inspecting the cache. It runs in the browser and React Native and is published under the MIT license. There is no paid tier for the library itself. Teams that want a minimal hook and nothing else may find the configuration surface larger than they need.
Standout: Mature cache with background refetch and deduplication
Free (open source), as listed by the vendor (TanStack Query website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Mature cache with background refetch and deduplication
- framework-agnostic core with React adapters
Drawbacks
- More concepts to learn than a plain hook
- devtools add setup work
Skip it if this limit matters to you: more concepts to learn than a plain hook.
Verdict. A sensible pick for REST and GraphQL apps that need a full async state cache.
Alternatives in this guide: SWR, RTK Query, Apollo Client
SWR
Best for small to mid-size apps that want a light data hook

What it is and where it fits
SWR is a React hooks library from Vercel for remote data fetching. It uses a stale-while-revalidate strategy: it returns cached data, then revalidates in the background. The core hook is useSWR, with helpers for pagination, infinite loading and mutation. It is MIT licensed and free to use. It runs wherever React runs, including Next.js and React Native. SWR is a good fit when you want caching and revalidation without a larger state layer. Teams that need fine-grained cache control or heavy mutation workflows often outgrow it.
Standout: Small API built on stale-while-revalidate
Free (open source), as listed by the vendor (SWR website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Small API built on stale-while-revalidate
- Simple pagination and focus revalidation helpers
Drawbacks
- Fewer built-in mutation and cache tooling options than TanStack Query
- Smaller ecosystem of plugins
Skip it if this limit matters to you: fewer built-in mutation and cache tooling options than TanStack Query.
Verdict. A sensible pick for small to mid-size apps that want a light data hook.
Alternatives in this guide: TanStack Query, RTK Query, Apollo Client
RTK Query
Best for redux Toolkit projects that want built-in data fetching

What it is and where it fits
RTK Query is part of Redux Toolkit and is included with it. You define API slices with endpoints, and it generates React hooks for queries and mutations. It handles caching, deduplication, polling and cache invalidation through tags. It is MIT licensed and free. Because it lives in Redux Toolkit, it fits best in apps that already use Redux for client state. If your app does not use Redux, adding it just for data fetching is usually more structure than needed, and TanStack Query or SWR is a simpler path.
Standout: Ships inside Redux Toolkit with generated hooks
Free (open source), as listed by the vendor (RTK Query website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Ships inside Redux Toolkit with generated hooks
- Cache tags drive automatic invalidation
Drawbacks
- Tied to Redux Toolkit conventions
- Adds Redux to apps that do not use it
Skip it if this limit matters to you: tied to Redux Toolkit conventions.
Verdict. A sensible pick for redux Toolkit projects that want built-in data fetching.
Alternatives in this guide: TanStack Query, SWR, Apollo Client
Apollo Client
Best for graphQL apps that need a normalized client cache

What it is and where it fits
Apollo Client is a GraphQL client for React and other platforms. It provides a normalized cache, hooks such as useQuery and useMutation, and integration with the Apollo GraphOS platform for schema checks and metrics. The client library is open source and free. Paid pricing applies to the hosted GraphOS services, so check the vendor pricing page for current plans. It is a strong fit for GraphQL APIs that benefit from normalized caching. Projects on REST, or teams that want a smaller GraphQL client, should compare urql.
Standout: Normalized cache and rich GraphQL tooling
Free (open source), as listed by the vendor (Apollo Client website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Normalized cache and rich GraphQL tooling
- Large documentation and community
Drawbacks
- GraphQL only
- Some platform features require a paid Apollo plan
Skip it if this limit matters to you: graphQL only.
Verdict. A sensible pick for graphQL apps that need a normalized client cache.
Alternatives in this guide: TanStack Query, SWR, RTK Query
urql
Best for graphQL apps that want a lightweight, extensible client

What it is and where it fits
urql is a GraphQL client maintained by Nearform. Its core is small, and behavior is composed through exchanges, which handle caching, retries and auth. It offers React bindings and a document cache by default, with a normalized cache available as an add-on package. It is MIT licensed and free. urql suits teams that want to control the request pipeline and keep the client lean. Teams that need a normalized cache with minimal setup, or heavy schema tooling, often pick Apollo Client instead.
Standout: Small core with an exchange-based extension model
Free (open source), as listed by the vendor (urql website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Small core with an exchange-based extension model
- Works with React, Preact, Svelte and Vue bindings
Drawbacks
- Smaller ecosystem than Apollo Client
- Fewer built-in cache features out of the box
Skip it if this limit matters to you: smaller ecosystem than Apollo Client.
Verdict. A sensible pick for graphQL apps that want a lightweight, extensible client.
Alternatives in this guide: TanStack Query, SWR, RTK Query
Relay
Best for large GraphQL apps built on the Relay specification

What it is and where it fits
Relay is a GraphQL client from Meta. It uses a compiler to extract queries at build time and colocate data requirements with components. It relies on the Relay specification for the server, including global object identification and cursor-based connections. It is MIT licensed and free. Relay fits large applications where fragment composition and cache consistency matter. It is a poor fit for REST APIs, for small projects, or for GraphQL servers that do not follow the Relay spec. Check the docs before committing, since setup differs from other clients.
Standout: Compiler-driven queries with colocated fragments
Free (open source), as listed by the vendor (Relay website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Compiler-driven queries with colocated fragments
- Strong cache consistency for large apps
Drawbacks
- Requires a Relay-compliant GraphQL server
- Steeper learning curve than other clients
Skip it if this limit matters to you: requires a Relay-compliant GraphQL server.
Verdict. A sensible pick for large GraphQL apps built on the Relay specification.
Alternatives in this guide: TanStack Query, SWR, RTK Query
React Router loaders
Best for apps already on React Router that want route-level data loading

What it is and where it fits
React Router includes data APIs: loaders and actions that run before a route renders, plus error boundaries and pending states. This gives route-level data fetching without adding a separate cache library. It is MIT licensed and free. It runs in the browser and in server-rendered setups. React Router loaders fit apps that already use the data router and want fetching tied to navigation. They are not a general-purpose cache, so apps with heavy client-side caching needs often pair them with TanStack Query.
Standout: Data loading tied to routes with no extra library
Free (open source), as listed by the vendor (React Router loaders website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Data loading tied to routes with no extra library
- Works with the framework and data router modes
Drawbacks
- No standalone cache outside the router
- Less suited to component-level fetching patterns
Skip it if this limit matters to you: no standalone cache outside the router.
Verdict. A sensible pick for apps already on React Router that want route-level data loading.
Alternatives in this guide: TanStack Query, SWR, RTK Query
Who should use what
If you have a REST or mixed API and want a full cache, start with TanStack Query. If you want a small hook with background revalidation, use SWR. If your app already runs on Redux Toolkit, use RTK Query to avoid a second state layer. For GraphQL, compare Apollo Client for a normalized cache and platform tooling against urql for a smaller, exchange-based client; choose Relay only if your server follows the Relay spec. If you use React Router's data router and want fetching tied to routes, its loaders may be enough.
Questions to settle before you buy
What to check before you buy
- Confirm the library supports your transport: REST, GraphQL, or both.
- Check the React version and rendering mode (client, server, streaming) in the docs.
- Review cache defaults, retry behavior and how mutations invalidate data.
- Check bundle size and whether tree-shaking works with your build setup.
- Read the license and any paid platform features before adopting vendor services.
FAQ
Do I need a data fetching library if I use fetch?
Not always. For a few requests, plain fetch with useEffect works. A library helps once you need caching, deduplication, retries, background refetching or mutation invalidation across many components.
Which library works with both REST and GraphQL?
TanStack Query and SWR work with any promise-based source, including REST and GraphQL. Apollo Client, urql and Relay are GraphQL clients. RTK Query supports both through custom base queries.
Are these libraries free?
Yes. All seven are open source and free to use. Apollo Client and urql connect to optional paid vendor platforms, so check the vendor pricing page for those services.
Can I use these with React Native?
TanStack Query, SWR, Apollo Client and urql support React Native. RTK Query works wherever Redux Toolkit runs. Relay and React Router loaders are more commonly used in web apps.
Do these libraries send my data to a third party?
The client libraries run in your app and call the endpoints you configure. Data leaves your app only if you enable a hosted vendor service, such as Apollo GraphOS, or point requests at a third-party API.
Sources we checked
Method: how we score · editorial policy.
Change log. First published 27 Nov 2026.