Skip to content Skip to sidebar Skip to footer

React Native Fetch Promise .then() Not Executing Immediately

I'm using React Native to build an app for iOS and Android. In there, I'm simply calling fetch function from an external function once a button is tapped. The fetch function sends

Solution 1:

fetch will return a Promise object, the callbacks added by then() will be called after the promise is success. If the promise failed, the callback added by catch() will be called.

you can check fetch and promise document in https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise.

Post a Comment for "React Native Fetch Promise .then() Not Executing Immediately"