I'm trying to call an API with fetch from React Native App but it doesn't log the response data (console.warn('data', data)) for some reason. It prints the 'call to getArtists' log but then nothing happens.
const URL = 'https://jsonplaceholder.typicode.com/posts'
function getArtists(){
console.log('call to getArtists')
return fetch(URL)
.then(response => response.json())
.then(data => {
console.warn('data', data)
})
}
Code is available here: https://snack.expo.io/rkzea2Zlm at components/api-client.js
What am I doing wrong?
datatooURL = 'https://facebook.github.io/react-native/movies.json'makes the request works. But others doesntresponseJSONinstead ofdatait works, but I dont understand. The real API I need (LastFM) doesnt work