I am trying to load external data with fetch into a react-native mobile app. I have tried with different sources and mostly I get an error message saying the network can't be found. For instance I have tried with the following two sources.
http://facebook.github.io/react-native/movies.json (does not work) https://raw.githubusercontent.com/facebook/react-native/master/docs/MoviesExample.json (works)
componentDidMount(){
var REQUEST_URL = 'http://facebook.github.io/react-native/movies.json';
fetch(REQUEST_URL).then((response) => {
console.log(response);
if(response.ok) {
console.log('Response OK');
} else {
console.log('Network response was not ok.');
}
})
.catch((error) => {
console.log('There has been a problem with your fetch operation: ' + error);
})
.done();
}
I am testing in IOS simulator on my MacBook.
I also tried to get json data from my WordPress site, with the latest version of the WP REST API plugin installed. Also this returned a can't find network error.
I am really stuck on this one.
