Skip to content

Marker not rendering on localhost using latest version #3019

@Krechals

Description

@Krechals

Marker is not rendering on localhost using @react-google-maps/api@2.10.2

However, after downgrading to @react-google-maps/api@2.7.0, the Marker is displayed on the map.

Here is the code snippet I am using:

function Map() {
  const position = useMemo(() => ({ lat: 44.426765, lng: 26.102537 }), []);
  const { isLoaded } = useLoadScript({
    googleMapsApiKey: process.env.REACT_APP_GOOGLE_MAPS_API_KEY,
  });

  if (!isLoaded) return <div> Loading Maps... </div>
  return (
      <GoogleMap 
        zoom={10}
        center={position}
        mapContainerStyle={{ width: '400px', height: '400px'}}
      >
        <Marker position={position} /> 
      </GoogleMap>
  );
}

Environment

os: Linux

node --version: v16.13.0

react version: 18

@react-google-maps/api version: 2.10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions