Features Overview

A high-level architectural index of every native capability built into react-native-fetch-client with zero runtime dependencies.


Core Capabilities

Zero Dependencies

Uses Fetch APIs and has no production runtime dependencies in the package manifest.

Single-Flight 401 Auth Mutex

When multiple concurrent requests fail with HTTP 401, a mutex ensures only one refresh token handshake occurs. All waiting requests are automatically re-executed with the new bearer token once resolved.

SWR & Mutation-Aware Cache

Optional in-memory LRU caching with stale-while-revalidate and request-level cache settings. Successful mutations invalidate matching cached paths; add cache.invalidate patterns for related routes.

Smart Retries & Circuit Breaker

Exponential backoff with full jitter to avoid the thundering herd problem. Honors HTTP Retry-After headers and includes a Circuit Breaker that fails fast during server degradation.

In-Flight Request Deduplication

Matching eligible requests share one in-flight network operation. If one caller aborts, the shared operation can continue for remaining callers.

Native SSE & AI Token Streaming

Read Server-Sent Events or chunked responses with the api.stream() async generator. Runtime stream support is required.

Auto-Pagination & Polling

Iterate pages seamlessly using async generators across page, offset, cursor, or RFC 5988 Link header strategies. Includes smart polling with exponential backoff.

Testing Mock Adapter

A built-in createMockAdapter for registering mock handlers and inspecting recorded requests.

Runtime requirements

The package uses the runtime's Fetch implementation. Availability of streams, persistent storage adapters, and platform integrations depends on your environment and the adapters you provide. The package metadata declares Node.js 18 or newer; see the platform guides for details.