# react-gmaps

> A Google Maps component for React.js

Latest version **1.9.0** (published 2018-03-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-gmaps
pnpm add react-gmaps
yarn add react-gmaps
bun add react-gmaps
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.0 |
| Published | 2018-03-10 |
| First published | 2015-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 146.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 316 |
| Author | Michele Bertoli |
| Maintainers | michelebertoli |
| Keywords | React.js, Google Maps, react-component |

## Links

- npm: https://www.npmjs.com/package/react-gmaps
- Repository: https://github.com/MicheleBertoli/react-gmaps
- Issues: https://github.com/MicheleBertoli/react-gmaps/issues
- npm.io page: https://npm.io/package/react-gmaps

## Dependencies (2)

- [object-assign](https://npm.io/package/object-assign.md) ^4.0.1
- [create-react-class](https://npm.io/package/create-react-class.md) ^15.5.2

## Recent versions

- 1.9.0 (latest) — 2018-03-10
- 2.0.0-next.0 (next) — 2023-09-09
- 1.8.0 — 2018-03-04
- 1.7.0 — 2017-10-09
- 1.6.0 — 2017-05-07
- 1.5.0 — 2016-04-27
- 2.0.0-rc4 — 2016-04-03
- 2.0.0-rc3 — 2016-04-02
- 2.0.0-rc2 — 2016-04-01
- 2.0.0-rc1 — 2016-03-30
- 1.4.4 — 2016-03-22
- 1.4.3 — 2016-03-05
- 1.4.2 — 2016-02-16
- 1.4.1 — 2016-02-07
- 1.4.0 — 2016-02-05
- … 32 more at https://npm.io/package/react-gmaps/versions

## README

[![Build Status](https://travis-ci.org/MicheleBertoli/react-gmaps.svg?branch=master)](https://travis-ci.org/MicheleBertoli/react-gmaps)

React Gmaps
===========

A [Google Maps](https://developers.google.com/maps/documentation/javascript/) component for [React.js](http://facebook.github.io/react/)

Features
--------

- Lazy Google Maps loading
- Easy to use

Installation
------------

```sh
$ npm install react-gmaps --save
```

Demo
------------

[http://react-gmaps.herokuapp.com/](http://react-gmaps.herokuapp.com/)

Usage
-----

```javascript
import React from 'react';
import ReactDOM from 'react-dom';
import {Gmaps, Marker, InfoWindow, Circle} from 'react-gmaps';

const coords = {
  lat: 51.5258541,
  lng: -0.08040660000006028
};

const params = {v: '3.exp', key: 'YOUR_API_KEY'};

class App extends React.Component {

  onMapCreated(map) {
    map.setOptions({
      disableDefaultUI: true
    });
  }

  onDragEnd(e) {
    console.log('onDragEnd', e);
  }

  onCloseClick() {
    console.log('onCloseClick');
  }

  onClick(e) {
    console.log('onClick', e);
  }

  render() {
    return (
      <Gmaps
        width={'800px'}
        height={'600px'}
        lat={coords.lat}
        lng={coords.lng}
        zoom={12}
        loadingMessage={'Be happy'}
        params={params}
        onMapCreated={this.onMapCreated}>
        <Marker
          lat={coords.lat}
          lng={coords.lng}
          draggable={true}
          onDragEnd={this.onDragEnd} />
        <InfoWindow
          lat={coords.lat}
          lng={coords.lng}
          content={'Hello, React :)'}
          onCloseClick={this.onCloseClick} />
        <Circle
          lat={coords.lat}
          lng={coords.lng}
          radius={500}
          onClick={this.onClick} />
      </Gmaps>
    );
  }

};

ReactDOM.render(<App />, document.getElementById('gmaps'));
```

Test
----

```sh
$ npm test
```

---
_Source: https://npm.io/package/react-gmaps · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
