Skip to content Skip to sidebar Skip to footer

Issues With Google Maps Javascript Api, Marker And Polylines Not Showing Together On A React.js App

I am pretty sure the states and setState stuff are correct, so here is my code. What I did here was I assigned the map key with the function this.initMap(). To have a detailed look

Solution 1:

This is happening because you instantiate your map multiple times. Every time you call this.initMap() you create a new map instance, so what you should do is call this method only once (probably in constructor), assign it to some variable and then use that variable when referring to your map in Marker() and Polyline() methods.


Post a Comment for "Issues With Google Maps Javascript Api, Marker And Polylines Not Showing Together On A React.js App"