title: Fetch requests in ReactJS
body: <p>I am working in a small application for a class I am taking and I have an issue when I am using the fetch API </p>
  
  <pre><code>class App extends React.Component {
    constructor(props) {
      super(props);
      this.state = {
        map: "",
        markers: [],
        Data: []
      };
    }
  
    componentDidMount() {
      fetch(
        `https://api.foursquare.com/v2/venues/explore?near=ashkelon&amp;v=20180729&amp;client_id=MVLZGLPIAITJITM0OOFYER3C2ZRT5ERGGEWCC0T1YWV3HFZA&amp;client_secret=1TBLTY0TSM1T320FEO3BJBGTMYVQPCMBOGO5GEBC0ZB1E5LK`
      )
        .then(function(response) {
          return response.json();
        })
        .then(
          function(data) {
            this.setState({ Data: data });
          }.bind(this)
        )
        .catch(function(e) {
          console.log("There is an issue with getting the information", e);
        });
    }
  }
  
  window.initMap = this.initMap;
  loadJS("https://maps.googleapis.com/maps/api/js?key=AIzaSyDySeqpuOjQlckWJUMlbSW_w5CydOVTWJI&amp;callback=initMap");
  </code></pre>
  
  <p>UPDATE : 
  this will not provide with an error and the state is set, but what now happens is that my state is empty when i log the state in the initMap method.</p>
  
  <p>At this point i see that the state is set for "that".
  But if its set for "that" how can i use "this" state in the rest of my application i need this information to create markers on the google maps API</p>
  
  <p>thanks in advance.</p>