expo-data-fetching

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

Updated Sep 6, 2026
One-click install
npx skills add https://github.com/sombek/fitness-guidance-app --skill expo-data-fetching-sombek
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: expo-data-fetching
Source: https://github.com/sombek/fitness-guidance-app/tree/main/mobile/.agents/skills/expo-data-fetching
Command: npx skills add https://github.com/sombek/fitness-guidance-app --skill expo-data-fetching-sombek

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 moving parts: fetch error handling, token storage, caching, retries, offline behavior, and environment-based API configuration. This Skill provides proven patterns and code for each of these concerns so you avoid common mistakes like insecure token storage or missing error handling. ## Core Features & Use Cases - Fetch and Error Handling: Typed API errors, exponential backoff retries, and AbortController cancellation for fetch-based requests. - React Query and SWR Integration: QueryClient setup, queries, mutations, cache invalidation, and offline-first configuration synced with NetInfo network status. - Authentication and Configuration: Token storage with expo-secure-store, token refresh flows, and EXPO_PUBLIC_ environment variables for per-environment API URLs. - Expo Router Data Loaders: Route-level server and static data loading with useLoaderData, StatusError, and Suspense boundaries for web on SDK 55+. - Use Case: You are building an Expo app that calls a REST API with bearer tokens and must keep working offline. Use this Skill to set up React Query with NetInfo, secure token storage, and retry logic. ## Quick Start Use the expo-data-fetching skill to set up React Query with error handling and offline support for my Expo app's API calls.

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 error handling: check response.ok before parsing JSON and throw typed errors for HTTP failures. For apps needing caching and state management, wrap requests in React Query queries and mutations.

Should I use React Query or SWR for data fetching?

React Query fits complex apps needing mutations, cache invalidation, and offline persistence, while SWR suits simpler fetching needs. Both work in Expo, but this Skill recommends React Query for offline-first setups with NetInfo integration.

How do I store authentication tokens securely in Expo?

Store tokens with expo-secure-store, not AsyncStorage, since SecureStore encrypts sensitive values. Implement a token refresh flow that deduplicates concurrent refresh requests using a shared promise.

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. Loaders run server-side in server output mode or at build time in static mode, but they are web-only and unavailable in _layout files.

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

Define EXPO_PUBLIC_ prefixed variables in .env.development and .env.production files, then read them via process.env. Never put secrets in EXPO_PUBLIC_ variables since they are embedded in the client bundle; use non-prefixed variables in API routes instead.

Why do my Expo network requests fail when the device goes offline?

Fetch throws network errors when connectivity drops, and without handling this surfaces as unhandled failures. Use NetInfo to detect network status and sync it with React Query's onlineManager so queries pause offline and resume when connectivity returns.