import React from "react"; import { compose, withProps } from "recompose"; import { withScriptjs, withGoogleMap, GoogleMap, Marker } from "react-google-maps"; // import InfoBox from "react-google-maps/lib/components/addons/InfoBox"; // const { InfoBox } = require("react-google-maps/lib/components/addons/InfoBox"); const MyMapComponent = compose( withProps({ googleMapURL: "https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=geometry,drawing,places", loadingElement:
, containerElement:
, mapElement:
, mapTypeId: 'hybrid' }), withScriptjs, withGoogleMap )((props) => {props.isMarkerShown && } ) export default class MyFancyComponent extends React.PureComponent { state = { isMarkerShown: false, } componentDidMount() { this.delayedShowMarker() } delayedShowMarker = () => { setTimeout(() => { this.setState({ isMarkerShown: true }) }, 3000) } handleMarkerClick = () => { this.setState({ isMarkerShown: false }) this.delayedShowMarker() } render() { return ( ) } }