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

Use the API libraries without the need of using a map first [Feat] #331

Closed
benshabatnoam opened this issue Apr 30, 2024 · 5 comments
Closed

Comments

@benshabatnoam
Copy link

Target Use Case

We want to be able to use the google map libraries without wrapping our component inside a map as we don't need one.
We want to use the Gecoding class in order to get lat and long for some random address.

Proposal

Currently the useMapsLibrary('geocoding') will work only if our component is wrapped with a APIProvider and Map components.
Can't we just use this hook without a APIProvider and Map component wrappers?
Thanks!

@usefulthink
Copy link
Collaborator

You can't use it without the APIProvider, but you should be able to use it without a Map. If that's not the case it would definitely be a bug.

The APIProvider is needed since that is the component that handles loading the maps-API (in the current implementation that is essentially setting up the google.maps.importLibrary function that is needed for the useMapsLibrary hook). We will always load the core and maps libraries of the google maps API, but that is likely not making a difference, since those will be dependencies for everything else.

@benshabatnoam
Copy link
Author

I agree, using the APIProvider make sense.
(Still I suggest you guys update this doc as it's not 100% clear from it that one should use the APIProvider to use that hook)

As for the Map wrapper, I'm pretty sure that I needed it as well, I'll double check that and if so I'll try to make a small demo to demonstrate that.

Thanks a lot.

@usefulthink
Copy link
Collaborator

@usefulthink
Copy link
Collaborator

updated README: #332

@benshabatnoam
Copy link
Author

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

2 participants