I want to get the current zoom level of my map in react-google-maps like we do in simple google map api with the getZoom() function. How to do this in react-google-maps ?
I have looked few answers but none of them are working for me.
import React from "react"
import {
GoogleMap,
Marker,
withGoogleMap,
withScriptjs,
} from "react-google-maps"
const Map = () => {
return (
<GoogleMap
defaultZoom={15}
defaultCenter={{ lat: lat, lng: lng }}
>
<Marker position={{ lat: lat, lng: lng }} />
</GoogleMap>
)
}
const WrappedMap = withScriptjs(withGoogleMap(Map))
const Index = () => {
return (
<Layout>
<WrappedMap
googleMapURL={`https://maps.googleapis.com/maps/api/js?
key=my_key&v=3.exp&libraries=geometry,drawing,places`}
loadingElement={<Loading />}
containerElement={<div style={{ height: `400px` }} />}
mapElement={<div style={{ height: `100%` }} />}
/>
</Layout>
)
}
export default Index
How can I getZoom for the above shown example.