[Solved] How to get multiple API fetch data avoid first consle.log empty array

To avoid Warn: Possible unhandled Promise Rejection (id:0) useEffect(() => { fetchData(); }, []); async function fetchData(){ try{ const requestArray = await Promise.all(ids?.map((id) => { return fetch(`https://jsonplaceholder.typicode.com/posts/${id}`) .then((response) => response.json()) .then((dataLoc) => { return dataLoc.title; }) .catch((error) => console.error(error)); })); console.log(JSON.stringify(requestArray)); setDataLoc(requestArray); } catch (error) { console.log(error); } } solved How to get multiple API … Read more

[Solved] Using fetch with Passport gets “No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”

OK this is an open issue with Passport: https://github.com/jaredhanson/passport/issues/582#issuecomment-506283986 I should use the href and not fetch. Possible duplicate of Cors error when sending request from React frontend to Google Oauth PassportJS on backend solved Using fetch with Passport gets “No ‘Access-Control-Allow-Origin’ header is present on the requested resource.”