APIProvider
Loads Google Maps Libraries and provided a Context for Map Components
Every Map component must be wrapped in an APIProvider component. This component is responsible for loading the Google Maps libraries and providing a context for the map components.
API Reference
Props
| Property | Default | Type/Description |
|---|---|---|
apiKey | - | stringAn API Key must be provided to load the Google Maps Javascript API. See Get API Key |
libraries | ['google-maps-api'] | string[]An array of libraries to load. See Libraries |
version | 'weekly' | stringThe version of the Google Maps API to load. See Versions |
region | - | stringThe region code, specified as a two-character ccTLD ("top-level domain") value. See Region Codes |
language | - | stringThe language code, specified as a BCP-47 language tag. See Language Codes |
authReferrerPolicy | - | stringThe referrer policy for the Maps JavaScript API requests. See Referrer Policy |
channel | - | stringTo understand usage and ways to improve our solutions, Google includes the solution_channel query parameter in API calls to gather information about code usage. You may opt out at any time by setting this attribute to an empty string.. See Channels |
solutionChannel | - | stringTo track usage of Google Maps JavaScript API via numeric channels. The only acceptable channel values are numbers from 0-999. See Channels |
Events
| Event Name | Type/Description |
|---|---|
| onLoad | () => voidCan be used to execute code after the Google Maps Javascript API has been loaded. |
| onError | (error: Error) => voidCan be used to handle errors that occur while loading the Google Maps Javascript API. |