A declarative React interface to Google Maps
JavaScript
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs Added Frag component Sep 15, 2014
examples Update project to be compatible with React 0.14 Oct 8, 2015
src Fix tests Oct 9, 2015
.gitignore First! Sep 4, 2014
.npmignore First! Sep 4, 2014
.travis.yml First! Sep 4, 2014
CHANGELOG.md Release 0.4.0 Jan 11, 2015
LICENSE First! Sep 4, 2014
README.md Release 0.4.0 Jan 11, 2015
index.js Update to 0.12 Dec 25, 2014
package.json Put dependencies in the right place Oct 9, 2015
preprocessor.js First! Sep 4, 2014
webpack.config.js First! Sep 4, 2014

README.md

React Google Maps Build Status

A declarative React interface to Google Maps.

Check it out:

Important Notes

This is an alpha release. The API and organizational structure are subject to change. Comments and contributions are much appreciated.

Installation

npm install react-googlemaps --save

This library is written with CommonJS modules. If you are using browserify, webpack, or similar, you can consume it like anything else installed from npm.

Usage

var React = require('react');
var ReactGoogleMaps = require('react-googlemaps');
var GoogleMapsAPI = window.google.maps;

var Map = ReactGoogleMaps.Map;
var Marker = ReactGoogleMaps.Marker;
var OverlayView = ReactGoogleMaps.OverlayView;

function handleClick(e) {
  console.log('Clicked at position', e.latLng);
}

React.render(
  <Map
    initialZoom={10}
    initialCenter={new GoogleMapsAPI.LatLng(-41.2864, 174.7762)}>

    <Marker
      onClick={handleClick}
      position={new GoogleMapsAPI.LatLng(-41.2864, 174.7762)} />

    <OverlayView
      style={{backgroundColor: '#fff'}}
      position={new GoogleMapsAPI.LatLng(-41.2864, 174.7762)}>
      <p>Some content</p>
    </OverlayView>
  </Map>,
  mountNode
);

Checkout the API docs or the examples directory for more detailed usage.

License

Licensed under MIT. Full license here »