I want to fetch Data and display in on react-google-maps
https://tomchentw.github.io/react-google-maps/#googlemap
The thing is that in order to fetch data, I need the maps bound as a query and I only get map bounds on onIdle
onIdle = () => {
console.log('MAP IS READY');
console.log('GET BOUNDS IN ON IDLE: ', this.mapRef.getBounds());
}
If I fetch data on onIdle, the component will update the map and call onIdle again. It causes an infinitive loop.
My question is that what is the best place in react goole maps to fetch data (note that I need maps bounds). Or I just fetch it on onIdle and check if it is fetched before fetching