title: Using Google Map in React Component
body: <p>I am trying to use Google Map in React Component and it doesn't seem to work.
  I am currently referring to <a href="https://developers.google.com/maps/documentation/javascript/adding-a-google-map" rel="noreferrer">https://developers.google.com/maps/documentation/javascript/adding-a-google-map</a></p>
  
  <p>Here is the code that I have for my component:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class ContactBody extends React.Component {
    componentWillMount() {
      const script = document.createElement("script");
      const API = 'AIzaSyDbAz1XXxDoKSU2nZXec89rcHPxgkvVoiw';
      script.src = `https://maps.googleapis.com/maps/api/js?key=${API}&amp;callback=initMap`;
      script.async = true;
  
      document.body.appendChild(script);
    };
  
    initMap() {
      const uluru = {lat: -25.363, lng: 131.044};
      const map = new google.maps.Map(document.getElementById('map'), {
        zoom: 4,
        center: uluru
      });
      const marker = new google.maps.Marker({
        position: uluru,
        map: map
      });
    }
  
    render() {
      
      this.initMap();
      
      return (
        &lt;div&gt;
          &lt;h1&gt;Contact&lt;/h1&gt;
          &lt;div id="map" style={{width: 400, height: 300}}&gt;&lt;/div&gt;
        &lt;/div&gt;
      )
    }
  }
  
  ReactDOM.render(
    &lt;ContactBody /&gt;,
    document.getElementById('react')
  );</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"&gt;&lt;/script&gt;
  &lt;div id="react"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>However, when I run this, I am getting "Uncaught ReferenceError: google is not defined"</p>
  
  <p>Could anyone tell me what is wrong with my code?</p>
  
  <p>Thank you.</p>