title: I want the function that fetches data to return a certain value
body: <p>I am trying to return the data fetched by the function getData() and use the returned value (<code>return this.getStreamer(values[0],values[1]);</code>) to render the <code>StreamerContainerResult</code> component.</p>
  
  <p>However, it keeps returning "undefined" and as a result, I cant render anything..</p>
  
  <p>I am stuck on this bug for the past few hours and I cant figure it out on my own.</p>
  
  <pre><code> getData(value, type) {
      let streamerData = [];
  
      let urls = ['https://wind-bow.gomix.me/twitch-api/streams/' + value, 'https://wind-bow.gomix.me/twitch-api/users/' + value];
  
      const getJson = url =&gt; fetch(url).then(res =&gt; res.json());
      Promise.all(urls.map(getJson))
             .then((values) =&gt; {
               if (type === "search") {
                 this.setState({
                   streamer: values
                 });
                 console.log("searching");
               } else {
                 console.log("displaying");
                 return this.getStreamer(values[0],values[1]);
               }
            }).catch(err =&gt; {
              console.log('Something went wrong...')
            });
  } 
  </code></pre>
  
  <p><a href="https://codepen.io/brood915/pen/OWQpmy?editors=0110" rel="nofollow noreferrer">https://codepen.io/brood915/pen/OWQpmy?editors=0110</a></p>