Menu

How to Mock API Calls in React Native and Expo
📰

How to Mock API Calls in React Native and Expo

DEV Community: reactnative·Sebastian Gedda·9 days ago
#lWTT2iec
#devtoreactnative#devto#dev#mockifyer#mock
Long article (1800 words) — no AI summary yet.
Reading 0:00
15s threshold

If you've tried to mock HTTP in a React Native or Expo app the way you do on the web, you've already hit the wall: there are no Service Workers . Whatever you choose has to intercept at the HTTP client ( fetch / axios) or sit on the network as a mock server the device can actually reach.

Jest stubs are still the right tool for a single module. msw/native is still a good fit when you want typed, in-code handlers for a small API. Mocking also unlocks offline development, stable demos, and deterministic Detox / Maestro / Appium runs.

This post is about the point where hand-written fixtures start to hurt — several backend systems, often several teams — and how to record real traffic once, replay it offline, and share the same mocks across simulators, physical devices, and CI. I built Mockifyer for that larger-app case. It is not a replacement for MSW when you want purely synthetic handler logic, and the approaches can coexist.

Pick the approach that matches the app

These can coexist.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.