Getting Started
Installation
npm install react-native-nitro-fetch react-native-nitro-modules
note
Nitro Modules requires React Native 0.75 or higher.
Rebuild your app
After installing, rebuild your app so the Nitro module is linked:
npx react-native run-android
# or
npx react-native run-ios
Verify with a simple request
import { fetch } from 'react-native-nitro-fetch';
export async function test() {
const res = await fetch('https://httpbin.org/get');
console.log('status', res.status);
console.log('headers', Object.fromEntries(res.headers));
console.log('json', await res.json());
}
Platform details
- Android uses Cronet (via
org.chromium.net:cronet-embedded) which is already included inandroid/build.gradle. No extra setup required. - iOS uses the native URLSession client.
WebSockets (optional)
Add the companion socket package plus the text decoder (peer dependency):
npm i react-native-nitro-websockets react-native-nitro-text-decoder
Then install native pods and rebuild:
cd ios && pod install && cd ..
npx react-native run-ios
See the WebSockets docs for full setup and API details.