Skip to content

How to render default google maps markers with this library. #1199

Description

@mkabatek

I know I can render any React component as pins with this library. However, I would like to use this library to render the default markers. How can I use the default markers in the way below?

      <GoogleMapReact
        defaultCenter={defaultCenter}
        defaultZoom={12} // You can adjust the initial zoom level
      >
        {markers.map((marker, index) => (
          <Marker
            key={index}
            lat={marker.lat}
            lng={marker.lng}
          />
        ))}
      </GoogleMapReact>

I know I can do something like this, and it will render the markers on Api load:


<GoogleMapReact
            bootstrapURLKeys={{
              key: "the_key_goes_here",
            }}
            center={defaultCenter}
            defaultZoom={5}
            yesIWantToUseGoogleMapApiInternals
            options={(map) => {
              return {
                mapTypeId: map.MapTypeId.HYBRID,
              };
            }}
            onGoogleApiLoaded={({ map, maps }) => {
              renderMarkers(map, maps, sites);
            }}
          ></GoogleMapReact>

I want to be able to update and refresh those default markers using THIS react component. Seems like a bug to not be able to do this easily. How can this be done?

How can I use, refresh, and update the default google maps markers?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions