title: Sleep function for React-Native?
body: <p>So I'm trying to fetch all 'places' given some location in React Native via the Google Places API. The problem is that after making the first call to the API, Google only returns 20 entries, and then returns a <code>next_page_token</code>, to be appended to the same API call <code>url</code>. So, I make another request to get the next 20 locations right after, but there is a small delay (1-3 seconds) until the token actually becomes valid, so my request errors.</p>
  
  <p>I tried doing: </p>
  
  <pre><code>this.setTimeout(() =&gt; {this.setState({timePassed: true})}, 3000);
  </code></pre>
  
  <p>But it's completely ignored by the app...any suggestions?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I do this in my <code>componentWillMount</code> function (after defining the variables of course), and call the <code>setTimeout</code> right after this line.</p>
  
  <pre><code>axios.get(baseUrl)
  .then((response) =&gt; {
     this.setState({places: response.data.results, nextPageToken: response.data.next_page_token });
  
  });
  </code></pre>