Answers for "react-google-maps satelite"

0

react-google-maps satelite

import React from 'react';
import {GoogleMap} from "@react-google-maps/api";
import {useLoadScript} from "@react-google-maps/api";

const mapContainerStyle = {
    width: '100vw',
    height: '100vh',
}
const center = {
    lat: 31.968599,
    lng: -99.901810,
}

const options = {
    mapTypeControl: true, // This allows user to switch between map and satelite mode
}

export default function GoogleMaps() {
    const{isLoaded, loadError} = useLoadScript({
        googleMapsApiKey: '<Your API Key>', // Insert your API key here
    });

    if (loadError) return "Error loading Maps";
    if (!isLoaded) return "Loading Maps";

    return(
        <GoogleMap 
        mapContainerStyle={mapContainerStyle} 
        zoom={11} 
        center={center} 
        options={options}
        />
    )
}
Posted by: Guest on February-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language