import React, { useState, useEffect } from "react"; import PropTypes from "prop-types"; import { Box, Button } from "grommet"; import { MAPS_API } from "../config"; function Maps(props) { const [ location, setLocation ] = useState([null, null]); useEffect(() => { navigator.geolocation.getCurrentPosition( position => setLocation([position.coords.latitude, position.coords.longitude]), () => {} ); }); const mapsEmbedUrl = new URL("https://www.google.com/maps/embed/v1/view"); mapsEmbedUrl.searchParams.append("key", MAPS_API); mapsEmbedUrl.searchParams.append("center", `${location[0]},${location[1]}`); mapsEmbedUrl.searchParams.append("zoom", 14); return ( {location[0] === null ? "Loading Location": }