Reputation: 445
I am using the react-mapbox-gl library and I am trying to access the lon/lat from the Mapbox Api on triggering an event on the map. I don't really understand where/how to access that info. I know that React has ref
for accessing child states but am not sure how that fits in with this library.
an example
<Map
style={mapStyle}
center={mapCenter}
containerStyle={mapContainerStyle}
//onDblClick access the lon lat somehow.
>
</Map>
Upvotes: 0
Views: 2149
Reputation: 173
As of [email protected].
<Map onDblClick={handleClick} />
which points to
function handleClick(map, event) {
var lngLat = event.lngLat;
}
Upvotes: 1