Skip to main content
Connect the googlemaps integration and the API key is injected as import.meta.env.VITE_GOOGLEMAPS_API_KEY — no workflow or fetch needed. @googlemaps/js-api-loader and @types/google.maps are pre-installed.

The map component

Then drop it anywhere: <MapComponent />.

Markers and geocoding

Gotchas

  • Always render the map container — never conditionally. If the ref div isn’t in the DOM, mapRef.current is null and the map never initializes. Overlay loading/error states on top instead.
  • Give the container an explicit height (e.g. h-[400px]), or the map renders at zero height.