MicheleBertoli / react-gmaps

A Google Maps component for React.js

Home Page:http://react-gmaps.herokuapp.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Get lat and long with pointer

ChuchoJuarez opened this issue · comments

Hi I want to know if it is possible to get the coordinates with the pointer.

regards

Hello @ChuchoJuarez, can you please explain what you are trying to do in more details?
I'm not sure what you mean by "with pointer".
Thanks!

Hey @ChuchoJuarez,
I'm assuming you want to get the coordinates of the user clicks. Below is a sample code snippet that would allow you to get the latitude and longitude of the user's click:

class Map extends Component{
onClick(e){
    var latLong = [e.latLng.lat(), e.latLng.lng()];
    console.log(latLong);
}
render(){
   return(
   <GMaps
    //insert params here
    onClick = {this.onClick}
   </GMaps>
   );
}
}

Thanks!!!!! @copperstick6 this is just what I needed