Mock Service Worker integration for React Native.
npm i -D @msw/react-native mswimport { network } from '@msw/react-native'
import { http, HttpResponse } from 'msw'
network.use(
http.get('https://example.com/user', () => {
return HttpResponse.json({ name: 'John' })
}),
)
network.enable()Make sure to import
@msw/react-nativebeforemswas it installs necessary polyfills, like the one forURL, that are required formswto function.