google-map-react / old-examples

Examples for google-map-react component.
http://google-map-react.github.io/google-map-react/map/main/
357 stars 314 forks source link

Conditional marker rendering #12

Closed kjeske closed 8 years ago

kjeske commented 8 years ago

When we try to use conditional rendering like:

<GoogleMap ...>
  {showMyMarker && <MyMarker lat={lat} lng={lng} />}
</GoogleMap>

the following exception will be thrown: TypeError: Cannot read property 'props' of null

I suppose the problem is that the GoogleMap component assumes that all the children are valid react components, so when one of the child is null (as in the example) the error is shown.

kjeske commented 8 years ago

wrong project :)