Announcement: New basemap styling is coming soon to Google Maps Platform. This update to map styling includes a new default color palette, modernized pins, and improvements to map experiences and usability. All map styles will be automatically updated in March 2025. For more information on availability and how to opt in earlier, see New map style for Google Maps Platform.
This example uses the
vis.gl/react-google-maps open
source library to render a Google map in a React app. The
vis.gl/react-google-maps library
is a collection of React components and hooks for the Google Maps JavaScript
API.
Git and Node.js are required to run this sample locally. Follow these instructions to install Node.js and NPM. The following commands clone, install dependencies and start the sample application.
[null,null,["Last updated 2025-03-01 UTC."],[[["This example demonstrates how to render a basic Google Map in a React application using the `vis.gl/react-google-maps` library."],["The `vis.gl/react-google-maps` library provides React components and hooks for integrating the Google Maps JavaScript API, but it's important to note it is open source and not officially supported by Google."],["The example includes code snippets for TypeScript, JavaScript, CSS, and HTML, showcasing the implementation of the map within a simple web page."],["Users can try the sample directly in Google Cloud Shell or clone the repository and run it locally using Git and Node.js."],["While the library itself is open source, any Google Maps Platform services utilized within it are subject to the Google Maps Platform Terms of Service."]]],["This content demonstrates how to render a Google map in a React app using the `@vis.gl/react-google-maps` library. Key actions include importing necessary components (`APIProvider`, `Map`), setting an API key, and rendering the map. The map's default zoom, center, gesture handling, and UI elements are configurable through props. The provided code includes TypeScript, JavaScript, CSS, and HTML examples. The guide also details how to run the sample locally or through the cloud shell.\n"]]