geocode addressobject to lat lng react code example
Example: react-geocode lat lng to address
// npm install react-geocode
// Don't forget to enter your Google API key in line 9 or this will not work
import Geocode from "react-geocode";
Geocode.setApiKey("<INSERT YOUR API KEY HERE>"); // Enter Google Maps API here
Geocode.enableDebug();
Geocode.fromLatLng("44.5", "-89.5").then(
response => {
const address = response.results[0].formatted_address;
console.log(address);
},
error => {
console.error(error);
}
);