react-map-gl
react-map-gl copied to clipboard
How to get current zoom level of the map?
What I need to do is to deactivate the highlight function until the users reach a certain higher zoom level. So is there a getZoom() function in this library and how to apply it? I'm confused since every answer on StackOverflow is about react-mapbox-gl but I don't have time to switch the whole codebase.
You can try using the "onZoom", in the object you'll see the zoom
<ReactMapGL {...viewport} onZoom={(e) => { console.log(e.viewState.zoom); }} >
the method you're looking for is onViewStateChange
<ReactMapGL {...viewport} onViewStateChange={(e) => { console.log(e.viewState.zoom); }} >