I am using the google-map-react NPM package to create a Google Map and several markers.
Question: How can we add the default Google Maps markers to
This may not be entirely clear from the description in the Readme, but the maps
argument is, in fact, the maps API object (and map
is, of course, the current Google Map instance). Therefore, you should pass both to your method:
onGoogleApiLoaded={({map, maps}) => this.renderMarkers(map, maps)}
and use them:
renderMarkers(map, maps) {
let marker = new maps.Marker({
position: myLatLng,
map,
title: 'Hello World!'
});
}