native-data-fetching

Implements secure fetch wrappers with typed error handling and retry logic for Expo apps.

52|22|Updated Nov 9, 2022
One-click install
npx skills add https://github.com/satsigner/satsigner --skill native-data-fetching-satsigner
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: native-data-fetching
Source: https://github.com/satsigner/satsigner/tree/main/.cursor/skills/native-data-fetching
Command: npx skills add https://github.com/satsigner/satsigner --skill native-data-fetching-satsigner

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear, production-oriented patterns to implement and debug network requests, API calls, and client-side data fetching so apps reliably retrieve and persist remote data while handling errors, retries, and offline scenarios.

Core Features & Use Cases

  • Fetch-first guidance for Expo and React Native apps with recommended use of the fetch API and Expo-specific storage for tokens.
  • Stateful caching and synchronization using React Query or SWR for staleTime, retries, invalidation, and persistence across network changes.
  • Robust error handling and authentication including typed API errors, retry with exponential backoff, abortable requests, token refresh flows, and secure token storage with expo-secure-store.
  • Offline support and environment configuration using NetInfo integration, React Query online manager, and build-time EXPO_PUBLIC_ environment variables for API endpoints.

Quick Start

Use the native-data-fetching skill to implement a secure fetch wrapper with token retrieval, error handling, retry logic, and offline detection in my 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 handle API authentication and secure token storage in an Expo React Native app?

API authentication and secure token storage in Expo apps are handled using the fetch API combined with expo-secure-store. This pattern ensures tokens are safely persisted and automatically retrieved for authorized network requests.

What's the best way to implement offline data fetching and caching with React Query?

Offline data fetching and caching with React Query are managed using NetInfo integration and the React Query online manager. This setup handles staleTime, persistence, and query invalidation across network changes for reliable offline sync.

How do I configure environment variables for API endpoints in Expo?

API endpoints in Expo are configured using build-time EXPO_PUBLIC_ environment variables. This approach provides configurable environment URLs for client applications to point to different API endpoints securely.

Can I implement retry logic with exponential backoff for fetch requests?

Retry logic with exponential backoff for fetch requests is supported through typed error handling and abortable requests. This ensures robust network requests automatically recover from transient failures.

Does this approach work with SWR for stateful caching and synchronization?

Yes, stateful caching and synchronization work with SWR or React Query. Both libraries manage staleTime, retries, and invalidation to synchronize remote data effectively across network changes.

How do I implement abortable requests and typed API error handling?

Abortable requests and typed API error handling are implemented by wrapping the fetch API with configurable logic. This ensures network requests can be safely cancelled and API errors are structurally typed for debugging.