Skip to content

[React] APIProvider in root component or specific component? #634

Answered by mrMetalWood
peterboccia asked this question in Q&A
Discussion options

You must be logged in to vote

I would say when you expect a user in a typical session to hit one of your maps it can make sense to load the api (via the APIProvider) in a parent component. In this case it would improve the performance because it is not in the same component as the map and the map could show immediately when the route is hit since the API is already loaded. The API loading happens asynchronously, so it does not block other stuff as well.

So it does't really "cost" anything to load the Maps API. I would only wait with the API loading if for some reason it is important that as few kilobytes as possible are downloaded.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by peterboccia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants