React component to render a map with markers from Google Maps API
npm install --save react-google-mapSee changelog
http://cedricdelpoux.github.io/react-google-map/
import React, { Component } from 'react'
import GoogleMap from 'react-google-map'
export default class MyComponent extends Component {
state = {
coordinates: [],
zoom: 8,
}
handleMapChange(coordinates, zoom) {
this.setState({ coordinates, zoom })
}
render() {
const { coordinates, zoom } = this.state
return (
<GoogleMap
coordinates={ coordinates }
zoom={ zoom }
onChange={ (coordinates, zoom) => this.handleMapChange(coordinates, zoom) }
/>
)
}
}coordinates: Array of objects with shape { description: String, latitude: Number, longitude: Number, title: String } - by default is []defaultLat: Number,defaultLng: Number,googleMaps: Object - injected by decorator,onChange: Function with two parameters (New coordinates object, actual zoom),zoom: Number - isRequired,
.googleMap
npm run cleannpm run buildnpm run watchnpm run lintSee MIT
