Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fourlabsldn/fl-google-maps-react

Wrapper around google maps to work with react
https://github.com/fourlabsldn/fl-google-maps-react

Last synced: 5 days ago
JSON representation

Wrapper around google maps to work with react

Awesome Lists containing this project

README

        

# React Wrapper for Google Maps

Based on this tutorial: [How to Write a Google Maps React Component](https://www.fullstackreact.com/articles/how-to-write-a-google-maps-react-component/)

We wrote our own version because you just couldn't use Ari Lerner's version with AMD.

# Usage
Use it like this:

``` javascript
import ReactDOM from 'react-dom';
import React from 'react';
import { Map, Marker, InfoWindow } from 'fl-google-maps-react';

class MyComponent extends React.Component {
constructor() {
super();
this.render = this.render.bind(this);
}

// Will open an info window on top of the clicked marker
onMarkerClick(marker) {
this.setState({
selectedPlace: 'Info window content text',
activeMarker: marker,
showingInfoWindow: true,
});
}

render() {
const props = this.props;
return (
// MyComponent must have set dimensions




{this.state.selectedPlace}





);
}
}

export default function (container, google) {
ReactDOM.render((), container);
}

```