JSFiddle - React, Tailwind, and code Playground
HTML
<div id="map" style="width: 500px; height: 400px;"></div>
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>
JavaScript
var map;
function initialize() {
var myLatlng1 = new google.maps.LatLng(0, 0.072050);
var mapOptions = {
zoom: 10,
center: myLatlng1,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map'),
mapOptions);
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
initialLocation = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
alert(initialLocation);
map.setCenter(initialLocation);
});
}
}
initialize();