I'm using the react-google-maps package and when leaving the page that has the map, I get the error message:
Uncaught TypeError: Cannot read property 'overlayMouseTarget' of null
Here is the code with the GoogleMap component:
const GMap = withGoogleMap((props) => (
<GoogleMap
ref={props.onMapMounted}
defaultZoom={12}
zoom={props.zoom}
onDragEnd={props.onZoomChanged}
onZoomChanged={props.onZoomChanged}
defaultCenter={props.defaultCenter}
center={props.center}
>
{
props.markers && props.markers.map((data, index) => (
<OverlayView
key={index}
position={{
lat: data.get('loc').get('geo').get('lat'),
lng: data.get('loc').get('geo').get('lng'),
}}
mapPaneName={OverlayView.OVERLAY_MOUSE_TARGET}
getPixelPositionOffset={(width, height) => ({ x: -(width / 2), y: -(height) })}
>
<WnmMarker
text={data.get('text')}
highlight={data.get('highlight')}
/>
</OverlayView>
))
}
</GoogleMap>
));
Can anyone point me to what might be causing this?
Thanks!