JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script>
<div id="map-canvas"></div>
CSS
#map-canvas{
height: 500px;
width: 500px;
}
JavaScript
function initialize() {
var mapOptions = {
center: { lat: 59.424959, lng: 24.7382414},
zoom: 12
};
var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
setInterval(function() {
var myLatlng = new google.maps.LatLng(59.424959,24.7382414);
var mapOptions = {
zoom: 12,
center: myLatlng
}
var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);
var marker = new google.maps.Marker({
position: myLatlng,
title:"Hello World!"
});
// To add the marker to the map, call setMap();
marker.setMap(map);
}, 5000);