Google-maps-react: Adding Marker Label using default google value

Created on 17 May 2018  Â·  5Comments  Â·  Source: fullstackreact/google-maps-react

google maps marker label usually using this

var marker = new google.maps.Marker({
position: location,
label: labels[labelIndex++ % labels.length],
map: map
});

Can we add label maker similar like that ?

Thanks

Most helpful comment

How did you solve it (for future users)?

All 5 comments

Where does ‘labels[]’ come from?

that is sample from google maps api.. but never mind I have solve this issue
Thanks

How did you solve it (for future users)?

OK, I wasn't able to find it in the documentation, but in case someone needs it, this works:

<Marker label="BB"/>

image

Hey...
I am not using this component anymore...
I am found simple way to working with google maps..

  1. load you google api url
  1. you can use componentDidMount and you can follow follow google maps api
    Sample

componentDidMount() {
let pos = {
lat: this.state.Latitude,
lng: this.state.Longitude
};
let map = new window.google.maps.Map(document.getElementById('map'), {
center: pos,
zoom: 13,
mapTypeId: 'roadmap',

    });
    marker = new window.google.maps.Marker({
        map: map,
        position: pos,
        draggable: true,
    });

}
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

anushreepatil picture anushreepatil  Â·  5Comments

samirbraga picture samirbraga  Â·  3Comments

colshacol picture colshacol  Â·  4Comments

joeyfigaro picture joeyfigaro  Â·  3Comments

matgargano picture matgargano  Â·  5Comments