I'm new to google maps and .env Environment variables I have this component that is rendering google maps I'm trying to set the Environment variable instead of embedding the google maps API key directly, but it's not showing up. here is my code...
import React from "react"
import {GoogleMap, LoadScript, Marker} from "@react-google-maps/api"
const MapContainer = () => {
const mapStyles = {
height: "50vh",
width: "100%"
}
const defaultCenter = {
lat: 40.668259, lng: -73.949158
}
const locations = [
{
name: "Brooklyn, NY",
location: {
lat: 40.668259,
lng: -73.949158
}
}
]
return (
<LoadScript
googleMapsApiKey={`${process.env.REACT_APP_GOOGLE_KEY}`}>
<GoogleMap
mapContainerStyle={mapStyles}
zoom={13}
center={defaultCenter}>
{
locations.map(item => {
return (
<Marker key={item.name} position={item.location}/>
)
})
}
</GoogleMap>
</LoadScript>
)
}
export default MapContainer
Could somone please help me.