Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including react-hook-google-maps with all npm packages installed. Try it out:

require("react/package.json"); // react is a peer dependency. require("react-dom/package.json"); // react-dom is a peer dependency. var reactHookGoogleMaps = require("react-hook-google-maps")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

react-hook-google-maps v0.0.3

React useGoogleMaps hook


React useGoogleMaps hook

license version dependencies status CI build code coverage

Easiest way to use Google Maps in your React application.

For Google API documentation please check


npm install --save react-hook-google-maps


import * as React from "react";

import { useGoogleMaps } from "react-hook-google-maps";

const App = () => {
  const { ref, map, google } = useGoogleMaps(
    // Use your own API key, you can get one from Google (
    // NOTE: even if you change options later
      center: { lat: 0, lng: 0 },
      zoom: 3,
  console.log(map); // instance of created Map object (
  console.log(google); // google API object (easily get google.maps.LatLng or google.maps.Marker or any other Google Maps class)
  return <div ref={ref} style={{ width: 400, height: 300 }} />;

export default App;


Edit priceless-shaw-o6e7x




Jan Grzegorowski

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free