GoogleMap: a propriedade Center ou DefaultCenter deve ser definida
function App() {
const mapRef = useRef(null);
const [position, setPosition] = useState({
lat: 41,
lng: -71
});
function handleLoad(map) {
mapRef.current = map;
}
function handleCenter() {
if (!mapRef.current) return;
const newPos = mapRef.current.getCenter().toJSON();
setPosition(newPos);
}
return (
<GoogleMap
zoom={4}
onLoad={handleLoad}
onDragEnd={handleCenter}
center={position}
id="map"
mapContainerStyle={{
height: '900px',
width: '900px'
}}
>
</GoogleMap>
);
}
Manish Das