Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

geocoder?.geocode returns undefined #142

Open
ktranish opened this issue Sep 17, 2023 · 3 comments
Open

geocoder?.geocode returns undefined #142

ktranish opened this issue Sep 17, 2023 · 3 comments

Comments

@ktranish
Copy link

const geocoder = useGeocodingService();

const handleOnClick = async () => {
  const x = await geocoder?.geocode({
    location: { lat: 59.27240992362248, lng: 15.213029186736854 },
  });
  console.log(x?.results); //undefined
};
@yfr
Copy link
Member

yfr commented Sep 19, 2023

In what context did you used this code? Did you have set up the provider (referring to #143) correct and did you read teh documentaion about the hooks?

Here you can find the example for the geocoding service. https://github.com/ubilabs/google-maps-react-hooks/tree/develop/examples/geocoding-service

@chwoozy
Copy link

chwoozy commented Sep 19, 2023

Hi, I'm also facing this issue right now. The provider is set up correctly on my end. But this issue seems to be happening when it is ran on useEffect for the first load.

In what context did you used this code? Did you have set up the provider (referring to #143) correct and did you read teh documentaion about the hooks?

Here you can find the example for the geocoding service. https://github.com/ubilabs/google-maps-react-hooks/tree/develop/examples/geocoding-service

@Yrll21
Copy link

Yrll21 commented Nov 14, 2023

The sample code above did not seem to define the parameters for geocode() method which could have caused the "undefined".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants