my implementation of GoogleMapReact
looks like this:
<GoogleMapReact
key={mapMarkers}
onGoogleApiLoaded={initGeocoder}
options={{
disableDefaultUI: true,
disableDoubleClickZoon: true,
draggable: false,
scrollwheel: false,
zoomControl: false,
}}
distanceToMouse={() => {}}
bootstrapURLKeys={{ key: myKey }}
defaultZoom={5}
defaultCenter={{
lat: -27,
lng: 133,
}}
yesIWantToUseGoogleMapApiInternals
>
{mapMarkers.map((marker) => (
<Marker lat={marker.lat} lng={marker.lng} onChildClick={() => markerClicked(marker)} />
))}
</GoogleMapReact>
however, when I click on the marker, the console.log()
in markerClicked
is never called?
const markerClicked = (marker) => {
console.log('clicked...')
console.log('The marker that was clicked is', marker)
}
how can I simply click on the marker as I want to show additional information once clicked?
I thought onChildClick
would work according to the docs but nothing is happening