I am trying to do a multiple parallel fetch requests in react-native
. But i don't get the response data as expected. What am i integrating it wrongly?
async componentDidMount() {
try {
let [res1, res2] = await Promise.all([
fetch(apiUrl1),
fetch(apiUrl2),
]);
console.warn(res1);
console.warn(res2);
}
catch(err) {
console.warn(err);
};
}
THis is the weird response i got.
{"_bodyBlob": {"_data": {"__collector": [Object], "blobId": "4", "offset": 0, "size": 661}}, "_bodyInit": {"_data": {"__collector": [Object], "blobId": "", "offset": 0, "size": 661}}, "headers": {"map": {"cache-control": "no-store, no-cache, must-revalidate", "cf-cache-status": "DYNAMIC", "cf-ray": "5", "content-type": "application/json; charset=utf-8", "date": "Thu, 09 Jan 2020 12:15:40 GMT", "expect-ct": "max-age=604800, report-uri=\"https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct\"", "expires": "", "pragma": "no-cache", "server": "cloudflare", "set-cookie": "ci_session=; expires=; Max-Age=7200; path=/; HttpOnly"}}, "ok": true, "status": 200, "statusText": undefined, "type": "default", "url": "apiurl"}
fetch API
. It should have been the right way of usingPromise.All
for parallel request but the problem is how to make it work withfetch API