Knowledge Base updated: 2026-11-01
react-google-maps knowledge base
@vis.gl/react-google-maps provides React bindings for the Google Maps JavaScript API. Its main surfaces are API loading, 2D and 3D map components, overlays, Static Maps URL utilities, and package entry points for browser and server-safe use.
Runtime state is held in provider and map-instance contexts: the API provider owns script readiness, while map components own native Google Maps instances and synchronize camera, options, events, and React children.
Examples exercise the exported surfaces across framework integrations. Package metadata defines the public browser, 3D, compatibility, and server entry points.
flowchart TD
App[React application] --> Provider[APIProvider]
Provider --> Loader[Google Maps JS API loader]
Loader --> MapsAPI[Google Maps JavaScript API]
Provider --> Map[Map]
Map --> MapContext[Map instance context]
Map --> Camera[Camera synchronization]
Map --> Controls[MapControl]
Map --> Overlays[2D overlays]
Provider --> Map3D[Map3D]
Map3D --> Scene[3D scene elements]
Map3D --> Map3DContext[3D map context]
App --> Static[StaticMap and URL utilities]
Package[Package entry points] --> Provider
Package --> Static
Examples[Examples and framework apps] --> Package
Glossary
- APIProvider: The provider that configures and exposes Google Maps JavaScript API loading state.
- Map instance context: Context used to register, select, and retrieve active 2D map instances.
- Controlled camera: Camera values supplied by React props and reconciled with native map camera changes.
- Map3D: The 3D Google Maps custom-element integration and its associated context.
- Server entry point: Export surface intended for map-related output that does not require browser rendering.
Invariants
- Google Maps API consumers require provider-managed loading context; see src/…/api-provider.tsx and src/…/use-api-loading-status.ts.
- A
Mapsynchronizes native camera updates back into React callbacks while applying supplied camera parameters; see src/…/use-map-camera-params.ts. - Native Maps objects are updated through prop reconciliation rather than recreated for every render; see src/…/use-*-instance.ts and src/…/use-*-options.ts patterns.
- Browser-dependent exports and server-safe exports remain distinct package entry points; see package.json
exports. - Example validation is workspace-driven and checks examples against the library package surface; see root package.json scripts and examples/…/package.json.
Routing table
- src/…/api-provider.tsx, src/…/use-api-loading-status.ts -> docs/api-loading-and-provider.md
- src/…/use-api-loading-status.ts, src/…/use-maps-library.ts -> docs/api-loading-hooks.md
src/components/map/**-> docs/map-runtime.md- src/…/map-control.tsx, src/…/use-map.ts -> docs/map-controls-and-access.md
src/components/marker/**, src/…/info-window.tsx,src/components/advanced-marker/**,src/components/overlay/**-> docs/map-overlays.mdsrc/components/marker/**,src/components/advanced-marker/**, src/…/info-window.tsx, src/…/pin.tsx -> docs/markers-and-info-windows.md- src/…/circle.tsx, src/…/rectangle.tsx, src/…/polygon.tsx, src/…/polyline.tsx -> docs/geometric-overlays.md
src/components/map-3d/**-> docs/three-dimensional-maps.mdsrc/components/map-3d/**,src/libraries/3d/**-> docs/three-dimensional-scene-elements.md- src/…/use-map-3d.ts, src/…/map-3d-context.ts -> docs/three-dimensional-map-access.md
src/components/static-map/**,src/static-maps/**, src/server.ts -> docs/static-maps.mdsrc/static-maps/**-> docs/static-maps-url-assembly.md- src/…/use-*.ts, src/…/use-*.ts,
src/hooks/**-> docs/react-integration-utilities.md - src/…/use-*-options.ts, src/…/use-*-instance.ts -> docs/map-object-option-reconciliation.md
- package.json, src/index.ts, src/index-3d.ts, src/server.ts,
src/types/**-> docs/package-exports-and-types.md - package.json, src/server.ts,
src/static-maps/**-> docs/server-safe-integration.md examples/**/src/**, examples/…/package.json -> docs/examples-and-framework-integrations.md- package.json, examples/…/package.json, examples/…/tsconfig.json -> docs/example-validation-workflows.md