Home >Web Front-end >JS Tutorial >Why Does My React Native `fetch()` Network Request Fail?
Causes and solutions for "React Native 'fetch()' Network Request Failure:"
Using the fetch() API in a React Native project You may receive a "Network Request Failed" error when making a network request using . >
fetch('http://facebook.github.io/react-native/movies.json') .then((response) => response.json()) .then((responseJson) => { return responseJson.movies; }) .catch((error) => { console.error(error); });To resolve, use [info.plist](https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/iPhoneOSKeys.html#//apple_ref/ doc/uid/TP40009251-SW8) to allow HTTP requests.
The above is the detailed content of Why Does My React Native `fetch()` Network Request Fail?. For more information, please follow other related articles on the PHP Chinese website!