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 | - | string An 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' | string The version of the Google Maps API to load. See Versions |
region | - | string The region code, specified as a two-character ccTLD ("top-level domain") value. See Region Codes |
language | - | string The language code, specified as a BCP-47 language tag. See Language Codes |
authReferrerPolicy | - | string The referrer policy for the Maps JavaScript API requests. See Referrer Policy |
channel | - | string To 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 | - | string To 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 | () => void Can be used to execute code after the Google Maps Javascript API has been loaded. |
onError | (error: Error) => void Can be used to handle errors that occur while loading the Google Maps Javascript API. |