title: fetch result from API returns undefined
body: <p>I am trying to fetch data from an API but keep getting undefined as result. I am using promise.all to chain API calls, and then chaining promises to do other operations on data. I seem to be unable to get my results to be passed to state.</p>
  <p>Here's the offending code:</p>
  <pre><code>if (gameDifficulty === &quot;mixed&quot;) {
    const result = await Promise.all([
      fetchClient.getData(
        getEndpoint(
          `amount=${countValues[0]}&amp;difficulty=easy&amp;type=${questionType}`
        )
      ),
      fetchClient.getData(
        getEndpoint(
          `amount=${countValues[1]}&amp;difficulty=medium&amp;type=${questionType}`
        )
      ),
      fetchClient.getData(
        getEndpoint(
          `amount=${countValues[2]}&amp;difficulty=hard&amp;type=${questionType}`
        )
      ),
    ])
      .then(function (responses) {
        console.log(responses);
        console.log(result); //returns undefined
        return Promise.all(
          responses.map(function (response, idx) {
            return fetchClient.processData(response, &quot;results&quot;);
          })
        );
      })
      .then(function (data) {
        console.log(data);
  
        console.log(result); // returns undefined
        return [...data[0], ...data[1], ...data[2]];
      });
  }
  </code></pre>