react.createfactory() react-google-maps code example

Example 1: react google ap

import {
  withScriptjs,
  withGoogleMap,
  GoogleMap,
  Marker,
} from "react-google-maps";

const MapWithAMarker = withScriptjs(withGoogleMap(props =>
  <GoogleMap
    defaultZoom={8}
    defaultCenter={{ lat: -34.397, lng: 150.644 }}
  >
    <Marker
      position={{ lat: -34.397, lng: 150.644 }}
    />
  </GoogleMap>
));

<MapWithAMarker
  googleMapURL="https://maps.googleapis.com/maps/api/js?key=AIzaSyC4R6AN7SmujjPUIGKdyao2Kqitzr1kiRg&v=3.exp&libraries=geometry,drawing,places"
  loadingElement={<div style={{ height: `100%` }} />}
  containerElement={<div style={{ height: `400px` }} />}
  mapElement={<div style={{ height: `100%` }} />}
/>

Example 2: npm google map api 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)

Example 3: google maps react

/* 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
*/