| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
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) }
/>
)
}
}npm run cleannpm run buildnpm run watchnpm run lintSee MIT
| Back | FazBrowse Home | New Git URL |