Adding Marker to Google Maps in google-map-react

前端 未结 4 1479
耶瑟儿~
耶瑟儿~ 2020-12-14 15:53

I am using the google-map-react NPM package to create a Google Map and several markers.

Question: How can we add the default Google Maps markers to

4条回答
  •  执念已碎
    2020-12-14 16:19

    Adding a marker on your map isn't as easy as we would like to, mostly because the confusing docs but here you have a super easy example:

    const Map = props => {
      return (
        
    
           {/* This is the missing part in docs:
             *
             * Basically, you only need to add a Child Component that
             * takes 'lat' and 'lng' Props. And that Component should
             * returns a text, image, super-awesome-pin (aka, your marker).
             *
             */}
           
        
      )
    }
    
    const Marker = props => {
      return 
    }

提交回复
热议问题