Tim
0
Q:

google maps react

import {Map, InfoWindow, Marker, GoogleApiWrapper} from 'google-maps-react';

export class MapContainer extends Component {
  render() {
    return (
      <Map google={this.props.google} zoom={14}>

        <Marker onClick={this.onMarkerClick}
                name={'Current location'} />

        <InfoWindow onClose={this.onInfoWindowClose}>
            <div>
              <h2>{this.state.selectedPlace.name}</h2>
            </div>
        </InfoWindow>
      </Map>
    );
  }
}

export default GoogleApiWrapper({
  apiKey: (YOUR_GOOGLE_API_KEY_GOES_HERE)
})(MapContainer)
3
/* Answer to: "google maps react"  */

/*
  "google-map-react" is a component written over a small set of the
  Google Maps API. It allows you to render any React component on
  the Google Map. It is fully isomorphic and can render on a server
  Additionally, it can render map components in the browser even if
  the Google Maps API is not loaded. It uses an internal, tweakable
  hover algorithm - every object on the map can be hovered.
  
  Install it here:
  https://www.npmjs.com/package/google-maps-react
  
  Don't forget it's also open-source! Here's the github page:
  https://github.com/google-map-react/google-map-react
*/
2
npm i -S @react-google-maps/api
0

New to Communities?

Join the community