I don't know how to describe title properly this time.
I am fetching data from google sheet API sheetson and the component render at least 2 times. Because I see it log() 2 times in the console. And also the images from API shows significant loading latency. So, I was wondering is it because of my implementation of the code.
console.log()
result:
const [busInfo, setBusInfo] = useState([]);
console.log(busInfo);
// get the data from google sheet
useEffect(() => {
(async function fetchBusInfo() {
const response = await fetch(url, {
headers: {
Authorization: `Bearer ${apiKey}`,
"X-Spreadsheet-Id": `${sheetID}`,
},
});
const data = await response.json();
setBusInfo(data.results);
})(); // IIFE
}, []);