Data · Fetching data from your API

Expo + SWR

SWR in an Expo SDK 57 app for iOS and Android, wired by one command and checked by doctor.

SWR is the small data layer: a stale-while-revalidate cache with a global fetcher, configured in src/lib/swr.tsx. I'd pick it over react-query when you mostly read data and want the smallest possible API surface - a string key is all a hook needs - and over apollo whenever your backend isn't GraphQL. It ships the same src/lib/api/client.ts (fetchJson) as the TanStack Query module, so switching between the two doesn't churn your API code.

When to pick SWR

SWR: The same job with a much smaller surface: a string key is a request. Good when you mostly read.

At a glance

Runs in Expo Go
Yes
Files added
8
npm packages
1
Keys to paste
EXPO_PUBLIC_API_URL
Included in
Starter and Pro
Tests included
2

Set it up

bun run setup --data swr

Setup copies the module in, installs SDK-matched versions and removes the options you did not pick. Then bun run doctor lists every key still missing, with a link to where you get it. The step-by-step guide is in the SWR docs.

SWR vs other data options

OptionExpo Gonpm packagesKeys to pasteIncluded in
SWRYes11Starter and Pro
TanStack QueryYes11Free, Starter and Pro
Apollo ClientYes31Starter and Pro

Questions

Can I use SWR in Expo Go?

Yes. This module runs in Expo Go, so you can try it before you make a development build.

What do I need to set up SWR in an Expo app?

Run bun run setup --data swr, then paste one key into .env: EXPO_PUBLIC_API_URL. bun run doctor lists any that are missing, with a link to where you get each one.

Does the ReadyNative free tier include SWR?

No. It ships in Starter and Pro (one payment, lifetime updates); the free tier uses TanStack Query for data.

Can I build the app without SWR?

Yes. Pick none for data (bun run setup --data none) - plain fetch; add TanStack Query/Apollo/SWR later.

SWR or TanStack Query for Expo?

SWR: The same job with a much smaller surface: a string key is a request. Good when you mostly read. TanStack Query: The default. Reach for it when you want mutations, invalidation and real cache control over a REST API.

SWR or Apollo Client for Expo?

SWR: The same job with a much smaller surface: a string key is a request. Good when you mostly read. Apollo Client: Pick it when your backend speaks GraphQL.

Which SWR version does it install?

For Expo SDK 57: swr ^2.3.0. Setup installs Expo packages with expo install, so they match the SDK.

Get it

SWR ships in Starter and Pro: one payment, lifetime updates. See pricing or browse every module.