nitro-fetch
Installation
SKILL.md
react-native-nitro-fetch
A focused reference for AI coding assistants working in a project that uses the react-native-nitro-fetch family of packages. Answer using the real APIs from this repo — not invented ones — by routing to the matching references/*.md file below.
Mental model
react-native-nitro-fetch is a drop-in, native-backed replacement for the browser networking stack on React Native:
fetch— WHATWG-compatible, backed byURLSession(iOS) andOkHttp/HttpURLConnection(Android) via Nitro Modules.NitroWebSocket— native WebSocket (libwebsockets + mbedTLS) with the same shape as the browserWebSocket.NitroTextDecoder— native UTF-8 decoder that beats the Hermes JS polyfill.
The performance story has three moving parts, and most questions end up being about one of them:
- Prefetching. Native code can run before React Native loads.
prefetchOnAppStart(...)andprewarmOnAppStart(...)replay stored requests / socket opens on every cold start, so by the time JS runs the response is already cached or the socket is alreadyOPEN. - Importing the native client. The default approach is explicit imports —
import { fetch } from 'react-native-nitro-fetch',import { NitroWebSocket } from 'react-native-nitro-websockets', or plugging into axios via a custom adapter. Alternatively, users can do a global replace (globalThis.fetch = fetch, etc.) at the top of their entry file — see the Global Replace docs for setup and trade-offs. - Seeing what's happening.
NetworkInspectorrecords HTTP + WS activity at the JS boundary; native Perfetto / Instruments traces cover everything below that (DNS, TLS, TTFB, body). One is for correctness, the other is for latency.