expo-data-fetching

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

Updated Sep 11, 2026
One-click install
npx skills add https://github.com/CYRUS-pinto/pi-bot --skill expo-data-fetching-cyrus-pinto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: expo-data-fetching
Source: https://github.com/CYRUS-pinto/pi-bot/tree/main/.agents/skills/expo-data-fetching
Command: npx skills add https://github.com/CYRUS-pinto/pi-bot --skill expo-data-fetching-cyrus-pinto

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, retries, caching, offline behavior, and environment-based API configuration. This Skill provides tested patterns and decision guidance so these concerns are implemented correctly the first time. ## Core Features & Use Cases - Fetch and Error Handling: Typed API errors, exponential backoff retries, and AbortController cancellation for raw fetch calls. - React Query and SWR Integration: QueryClient setup, mutations with cache invalidation, and offline-first syncing with NetInfo. - Authentication and Configuration: Token storage with expo-secure-store, refresh flows, and EXPO_PUBLIC_ environment variable management. - Expo Router Loaders: Route-level data loading with useLoaderData, StatusError, and server/static rendering modes for web on SDK 55+. - Use Case: A developer needs an authenticated, offline-tolerant feed in an Expo app. The Skill guides them to store tokens in SecureStore, wrap fetch with typed error handling, and connect React Query to NetInfo so queries pause offline and resume on reconnect. ## 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 error handling?

Use the fetch API and always check response.ok before parsing JSON, throwing typed errors for HTTP failures. Wrap calls in a helper that distinguishes network errors from HTTP errors, and add retry logic with exponential backoff for transient failures.

Should I use React Query or SWR for data fetching in Expo?

React Query suits complex apps needing mutations, cache invalidation, and offline persistence, while SWR fits simpler fetching needs. React Query also integrates with NetInfo through onlineManager to pause queries when the device goes offline.

How do I store authentication tokens securely in Expo?

Store tokens with expo-secure-store, not AsyncStorage, since SecureStore encrypts sensitive values. Implement a refresh flow that deduplicates concurrent refresh attempts so only one token refresh runs at a time.

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

Define EXPO_PUBLIC_API_URL in .env.development and .env.production files; Expo inlines these at build time. Never put secret keys in EXPO_PUBLIC_ variables since they ship in the client bundle—use non-prefixed variables in server-side API routes instead.

Do Expo Router loaders work on native platforms?

No, Expo Router data loaders are web-only and require SDK 55+ with server or static web output. For native platforms, use client-side fetching with React Query or fetch instead.

Why do my React Query requests keep running when the device is offline?

React Query does not detect network status by default in React Native. Connect it to NetInfo using onlineManager.setEventListener so queries pause when offline and resume automatically when connectivity returns.