Hi,
I am using the Map Component in a Vite-React-Typescript app. I would like to change the zoom level when the user changes visible layers. However, I get Error: map.goTo is not a function. How do I use the beloved goTo with the new Map Component? Also, I would love to provide a center to the goTo but I can't seem to find any spatial information when I log the map and look at the json. I just want to zoom in or out on the current center.
const [map, setMap] = useState(null)
useEffect(() => {
if (map) {
if (zoom) {
console.log('checking zoom', zoom, map)
map.goTo({ zoom })
} else if (Object.keys(extent).length > 0) {
map.extent = extent
}
}
}, [map, extent, zoom])
...
<ArcgisMap
basemap={'gray-vector'}
extent={extent}
popup={{ dockEnabled: true,
dockOptions: {
position: "top-right",
breakpoint: false
}} as any}
onArcgisViewReadyChange={(event: any) => {
setMap(event.target.map)
}}
></ArcgisMap>