GoogleMap.jsx
640 Bytes
import React, {useEffect} from "react";
import Dimensions from "react-dimensions";
let map, infoWindow;
const GoogleMap = (props) => {
useEffect(() => {
console.log('mount');
const { google } = window;
infoWindow = new window.google.maps.InfoWindow({});
map = new google.maps.Map(document.getElementById("map"), {
zoom: 11,
center: {lat: -34.397, lng: 150.644},
disableDefaultUI: true,
zoomControl: true
});
}, []);
return (
<div id="map" style={{height:props.containerWidth, backgroundColor:'pink'}}>
</div>
)
};
export default Dimensions()(GoogleMap) // Enhanced component