native-data-fetching

Implements network requests, caching, and offline support for Expo and React Native apps.

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill native-data-fetching-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: native-data-fetching
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/native-data-fetching
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill native-data-fetching-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @tanstack/react-query, expo-secure-store, @react-native-community/netinfo, and 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, and broken offline behavior. This Skill provides proven patterns for every data fetching scenario so you avoid common mistakes. ## Core Features & Use Cases - Fetch & Error Handling: Typed API errors, exponential backoff retries, and request cancellation with AbortController. - React Query & SWR Integration: Query client setup, mutations, cache invalidation, and offline-aware synchronization with NetInfo. - Authentication & Configuration: Secure token storage with expo-secure-store, token refresh flows, and environment-based API URLs using EXPO_PUBLIC_ variables. - Use Case: You are building an Expo app that must load user profiles, handle expired auth tokens, and keep working offline. This Skill gives you the exact patterns for each requirement, including Expo Router data loaders for web (SDK 55+). ## Quick Start Ask the AI to implement a cached API request with error handling and offline support in your Expo app.

Frequently Asked Questions about native-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?

Use the fetch API with explicit error handling: check response.ok before parsing JSON and throw typed errors for HTTP failures. For Expo apps, prefer expo/fetch over axios, and wrap requests in a reusable API client configured with your base URL.

Should I use React Query or SWR for data fetching?

React Query (TanStack Query) suits complex apps needing mutations, cache invalidation, and offline persistence. SWR fits simpler needs with lighter configuration. Both handle caching, deduplication, and automatic request cancellation.

How do I store authentication tokens securely in Expo?

Store tokens with expo-secure-store, never AsyncStorage, since SecureStore encrypts sensitive values. Implement a refresh flow that deduplicates concurrent refresh attempts and attaches the token as a Bearer header in an authenticated fetch wrapper.

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. Only EXPO_PUBLIC_ prefixed variables reach the client bundle, so keep secret keys in non-prefixed variables used only by server-side API routes.

How do I add offline support to React Native data fetching?

Use @react-native-community/netinfo to track connectivity and sync it with React Query via onlineManager.setEventListener. Queries then pause while offline and resume automatically when the connection returns.

Does Expo Router support route-level data loading?

Yes, Expo Router supports data loaders with useLoaderData on web starting from SDK 55. For native platforms, use React Query or fetch inside your components instead, as detailed in the skill's references.