Socket
Socket
Sign inDemoInstall

@react-google-maps/api

Package Overview
Dependencies
6
Maintainers
1
Versions
135
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @react-google-maps/api

React.js Google Maps API integration


Version published
Weekly downloads
524K
increased by3.03%
Maintainers
1
Install size
0.987 MB
Created
Weekly downloads
 

Readme

Source

@react-google-maps/api

React Google Maps API 1.0.3

This library requires React v16.6 or later. If you need support for earlier versions of React, you should check out react-google-maps

This is complete re-write of the (sadly unmaintained) react-google-maps library. We thank tomchentw for his great work that made possible.

@react-google-maps/api provides very simple bindings to the google maps api and lets you use it in your app as React components.

Here are the main additions to react-google-maps that were the motivation behind this re-write

Install @react-google-maps/api

npm i -S @react-google-maps/api

Main features

  • Simplified API
  • Uses the new Context API
  • Supports async React (StrictMode complient)
  • Removes lodash dependency => smaller bundle size 12.4kb, tree-shakeable https://bundlephobia.com/result?p=@react-google-maps/api@1.0.0
  • forbids loading of Roboto fonts, if you set property preventGoogleFonts on <LoadScript preventGoogleFonts /> component

Examples

Examples can be found in two places:

  1. Official docs (powered by docz). See the docs folder
  2. A Gatsby app including some examples. See the examples folder
  3. Gatsby.js Demo

Advice

You can save on bundle size if you import only components, which you use from @react-google-maps/api/lib/..., although whole library is tree-shakable.

Using the examples requires you to generate a google maps api key. For instructions on how to do that please see the following guide

Contribute

Maintainers and contributors are very welcome! See this issue to get started.

Migration from react-google-maps@9.4.5

if you need an access to map object, instead of ref prop, you need to use onLoad callback on <GoogleMap /> component.

Before:

// before
<GoogleMap
  ref={map => {
    const bounds = new window.google.maps.LatLngBounds();

    map.fitBounds(bounds);
  }}
/>

After:

<GoogleMap
  onLoad={map => {
    const bounds = new window.google.maps.LatLngBounds();
    map.fitBounds(bounds);
  }}
/>

Keywords

FAQs

Last updated on 01 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc