react-static-google-map icon indicating copy to clipboard operation
react-static-google-map copied to clipboard

Why are markers required?

Open jjavierdguezas opened this issue 2 years ago • 1 comments

First, thanks for this package!

I just want to display a map, centered in a location but I am getting "Component must have `Marker`, `Path` or `Direction` child" error

Google docs says that markers are optional image

so, why are they required? can we please make them optional?

jjavierdguezas avatar Jul 12 '21 11:07 jjavierdguezas

This makes sense. The StaticGoogleMap should probably support this case. We have outlined a couple of things that we would like to add to a V2 and this seems like one of those things. But there is no timeline on V2. Could you try this

const Blank = () => '';
<StaticGoogleMap center={...}>
  <Blank />
</StaticGoogleMap>

// or even
<StaticGoogleMap center={...}>
  {() => ''}
</StaticGoogleMap>

The StaticGoogleMap can take a component that is not one exported from this lib. The child components actually do not "render" any HTML but instead return additional query params to add the the URL for the map. By giving it a component that returns an empty string, I believe you will get the result you are looking for.

DaddyWarbucks avatar Jul 12 '21 16:07 DaddyWarbucks