expo-data-fetching

Implement and debug network requests, caching, and offline data fetching in Expo apps.

Updated Mar 27, 2026
One-click install
npx skills add https://github.com/gmackie/agent-skills --skill expo-data-fetching-gmackie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: expo-data-fetching
Source: https://github.com/gmackie/agent-skills/tree/main/skills/expo-data-fetching
Command: npx skills add https://github.com/gmackie/agent-skills --skill expo-data-fetching-gmackie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building reliable networking in Expo and React Native apps involves many pitfalls: unhandled HTTP errors, insecure token storage, missing retry logic, offline failures, and misconfigured API URLs across environments. This Skill provides proven patterns for every data fetching scenario so agents produce correct networking code on the first attempt. ## Core Features & Use Cases - Fetch and Error Handling: Typed API errors, exponential backoff retries, and response status validation using the fetch API instead of axios. - React Query and SWR Integration: QueryClient setup, mutations with cache invalidation, and offline-first configuration synced with NetInfo network status. - Authentication and Security: Token storage in expo-secure-store, authenticated fetch wrappers, and token refresh flows with deduplication. - Expo Router Data Loaders: Route-level server data loading with useLoaderData, LoaderFunction, StatusError, and Suspense boundaries for web on SDK 55+. - Use Case: A user asks how to configure different API URLs for development and production. The Skill guides the agent to use EXPO_PUBLIC_ prefixed environment variables with .env.development and .env.production files, while keeping secrets in non-prefixed variables for API routes only. ## Quick Start Ask the agent to set up data fetching with React Query and proper error handling for your Expo app.

Frequently Asked Questions about expo-data-fetching

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I make API calls in React Native with Expo?▼

Use the fetch API with explicit response status checks and typed error handling rather than axios. Wrap requests in a helper that throws an ApiError on non-OK responses and distinguishes network failures from HTTP errors.

Should I use React Query or SWR for data fetching?▼

React Query (TanStack Query) suits complex apps needing cache invalidation, mutations, retries, and offline persistence. SWR or custom hooks work for simpler fetching needs with less configuration.

How do I store authentication tokens securely in Expo?▼

Store tokens in expo-secure-store, never in AsyncStorage, which is not encrypted. Combine it with an authenticated fetch wrapper that attaches the Bearer token and a refresh flow that deduplicates concurrent refresh requests.

Does Expo Router support server-side data loading?▼

Yes, Expo SDK 55+ supports route-level data loaders on web via exported loader functions and the useLoaderData hook. Enable unstable_useServerDataLoaders in the expo-router plugin; loaders are web-only, so use React Query or fetch on native.

How do I configure different API URLs for dev and production in Expo?▼

Use EXPO_PUBLIC_ prefixed variables in .env.development and .env.production files, which are inlined at build time. Never put secrets in EXPO_PUBLIC_ variables since they ship in the client bundle; use non-prefixed variables in API routes instead.

How do I make a React Native app work offline?▼

Detect connectivity with @react-native-community/netinfo and sync it to React Query via onlineManager so queries pause offline and resume when reconnected. React Query persistence can queue and cache requests for offline-first behavior.