JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>    

<div id="map-canvas" style="border: 1px solid black; width: 1000px; height: 500px;"/>

JavaScript

var myLatlng = new google.maps.LatLng(41.850033, -87.6500523);

        function initialize() {
           
            var mapOptions = {
                zoom: 4,
                center: myLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            }
            var map = new google.maps.Map(document.getElementById("map-canvas"), mapOptions);

       
        }

        function getLatLongDetail() {
            
            var geocoder = new google.maps.Geocoder(); 
            geocoder.geocode({ 'latLng': myLatlng },
              function (results, status) {
                  if (status == google.maps.GeocoderStatus.OK) {
                      if (results[0]) {

                          var address = "", city = "", state = "", zip = "", country = "";
                          

                          for (var i = 0; i < results[0].address_components.length; i++) {
                              var addr = results[0].address_components[i];
                              // check if this entry in address_components has a type of country
                              if (addr.types[0] == 'country')
                                  country = addr.long_name;
                              else if (addr.types[0] == 'street_address') // address 1
                                  address = address + addr.long_name;
                              else if (addr.types[0] == 'establishment')
                                  address = address + addr.long_name;
                              else if (addr.types[0] == 'route')  // address 2
                                  address = address + addr.long_name;
                              else if (addr.types[0] == 'postal_code')       // Zip
                                  zip = addr.short_name;
                              else if (addr.types[0] == ['administrative_area_level_1'])       // State
                                  state = addr.long_name;
                              else if...