Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mkabatek opened this issue Sep 14, 2023 · 0 comments
Open

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

mkabatek opened this issue Sep 14, 2023 · 0 comments

Comments

@mkabatek
Copy link

mkabatek commented Sep 14, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant