You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are not writing fetch as intended in your repo.
Please write your fetch logic in a useEffect(() => {//your code}, [])
In the App function above the return statement and post your results again.
I did @pqminh, that's why I requested you to move it to the correct place. Right now I've no idea what lifecycle your code is going to follow outside of the app function. It needs to be inside the app function.
Description
Fetch takes so much time to call simple api. Over 60s
React Native version:
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
Android 10 (debug & release mode)
Steps To Reproduce
let startTime = new Date();
console.log('startTime', startTime.toLocaleString());
fetch('https://reactnative.dev/movies.json')
.then(response => response.json())
.then(json => {
let endTime = new Date();
console.log('endTime', endTime.toLocaleString());
console.log('duration', endTime - startTime);
return json.movies;
})
.catch(error => {
console.error(error);
});
I also try to use axios, xhr but still got this issue. Please help!
repo: https://github.com/pqminh/android-takes-much-time-to-call-api
The text was updated successfully, but these errors were encountered: