title: How can I call geoLocation in componentDidMount in React
body: <p>So I was trying to use axios to pull up an api along with HTML5Geolocation. </p>
  
  <p>I place it inside the componentDidMount and was expecting it to work atleast console.log the result using async and eventually set the state to the country.</p>
  
  <pre><code>componentDidMount(){
      async onLoad() {
          if (window.navigator.geolocation) {
             window.navigator.geolocation.getCurrentPosition(
             position =&gt; {
                const response = axios.get('http://ws.geonames.org/countryCode' , {
                     lat: position.coords.latitude,
                     lng: position.coords.longitude,
                     type: 'JSON'
                 });
                 console.log('here is the response &gt;&gt;&gt;&gt;', response.countryName); 
                 this.setState({ country: response.countryName })
             });
  
             }
           }
  
  }
  </code></pre>
  
  <p>However this is currently not working. I am using <a href="https://www.geonames.org/" rel="nofollow noreferrer">Geonames</a> for my API </p>
  
  <p>Any idea what am I doing wrong on my code?</p>