API reference
Every component, hook and type exported by the package.
import { GoogleMap, Marker, MapControl, useMap, useMapsLibrary, useGoogleMapsStatus } from 'google-maps-react-markers'<GoogleMap>
Loader
The first <GoogleMap> on the page configures the Maps JavaScript API. Later maps reuse it, and their loader props are ignored (with a warning in development if the key differs).
Prop
Type
Map
Prop
Type
Container
Prop
Type
Events
Mouse events receive (event: google.maps.MapMouseEvent, map), the others (map). See Events and camera.
Prop
Type
<Marker>
Prop
Type
<MapControl>
Prop
Type
Hooks
| Hook | Returns |
|---|---|
useMap() | google.maps.Map | null. Throws outside <GoogleMap>. |
useMapsLibrary(name) | the library, or null until loaded. |
useGoogleMapsStatus() | 'loading' | 'ready' | 'error'. |
Types
All prop and event types are exported: GoogleMapProps, MarkerProps, MapControlProps, MapChangeEvent, MapLoadEvent, MapEventProps, MarkerAnchor, MarkerAnchorPreset, MarkerDragHandler, MarkerRenderer, GoogleMapsLoaderOptions, GoogleMapsStatus, LatLngLiteral, BBox.