title: I'd like to destructure my api and return it using react How can I achieve this in my use-case?
body: <p>I would like to be able to get my api and return it however I'm not able to destructure the external response. When I check in my console, the api has returned and the response is filled with the proper json, however I'm not exactly sure how why I cannot access the results array and display the questions along with the other returned key value pairs. I currently am getting a mapping error saying map is undefined.</p>
  
  <p>Index.js</p>
  
  <pre><code> import React, { Component } from "react";
   import ReactDOM from "react-dom";
   import Hello from "./Hello";
   import "./style.css";
  
   class App extends React.Component {
   state = {
   isLoading: true,
   questions: [],
   error: null
   };
  
  fetchQuestions() {
  fetch(`https://opentdb.com/api.php? 
     amount=10&amp;difficulty=hard&amp;type=boolean`)
    .then(res =&gt; res.results)
    .then(data =&gt;
      this.setState({
        questions: data,
        isLoading: false
      })
    )
    .catch(error =&gt; this.setState({ error, isLoading: false }));
    }
  
    componentDidMount() {
    this.fetchQuestions();
     }
    render() {
    const { isLoading, questions, error } = this.state;
    return (
    &lt;React.Fragment&gt;
      &lt;h1&gt;Random User&lt;/h1&gt;
      {error ? &lt;p&gt;{error.message}&lt;/p&gt; : null}
      {!isLoading ? (
        questions.results.map(questions =&gt; {.    //something right here 
        //is erroring
          const { category, type, difficulty } = questions;
          return (
            &lt;div key={category}&gt;
              &lt;p&gt;Question Type: {type}&lt;/p&gt;
              &lt;p&gt;Difficulty: {difficulty}&lt;/p&gt;
              &lt;hr /&gt;
            &lt;/div&gt;
          );
        })
      ) : (
        &lt;h3&gt;Loading...&lt;/h3&gt;
      )}
      &lt;/React.Fragment&gt;
      );
      }
      }
  
      ReactDOM.render(&lt;App /&gt;, document.getElementById("root"));
  </code></pre>
  
  <p>Json File from Api</p>
  
  <pre><code> {
  "response_code": 0,
  "results": [
  {
    "category": "Entertainment: Video Games",
    "type": "boolean",
    "difficulty": "hard",
    "question": "The retail disc of Tony Hawk&amp;#039;s Pro Skater 5 only 
    comes with the tutorial.",
    "correct_answer": "True",
    "incorrect_answers": [
      "False"
    ]
  },
  {
    "category": "Science: Mathematics",
    "type": "boolean",
    "difficulty": "hard",
    "question": "The binary number &amp;quot;101001101&amp;quot; is equivalent 
   to the Decimal number &amp;quot;334&amp;quot;",
    "correct_answer": "False",
    "incorrect_answers": [
      "True"
    ]
  },
  {
    "category": "Science &amp; Nature",
    "type": "boolean",
    "difficulty": "hard",
    "question": "Scientists can grow teeth from urine.",
    "correct_answer": "True",
    "incorrect_answers": [
      "False"
    ]
  },
  {
    "category": "Entertainment: Video Games",
    "type": "boolean",
    "difficulty": "hard",
    "question": "In Undertale, having a &amp;quot;Fun Value&amp;quot; set to 56- 
  57 will play the &amp;quot;Wrong Number Song Call&amp;quot;.",
    "correct_answer": "False",
    "incorrect_answers": [
      "True"
    ]
  },
  {
    "category": "Entertainment: Japanese Anime &amp; Manga",
    "type": "boolean",
    "difficulty": "hard",
    "question": "Throughout the entirety of &amp;quot;Dragon Ball Z&amp;quot;, 
   Goku only kills two characters: a miniboss named Yakon and Kid Buu.",
    "correct_answer": "True",
    "incorrect_answers": [
      "False"
    ]
  },
  {
    "category": "Geography",
    "type": "boolean",
    "difficulty": "hard",
    "question": "Switzerland has four national languages, English being 
  one of them.",
    "correct_answer": "False",
    "incorrect_answers": [
      "True"
    ]
  },
  {
    "category": "Entertainment: Music",
    "type": "boolean",
    "difficulty": "hard",
    "question": "The band STRFKR was also briefly known as Pyramiddd.",
    "correct_answer": "True",
    "incorrect_answers": [
      "False"
    ]
  },
  {
    "category": "Science &amp; Nature",
    "type": "boolean",
    "difficulty": "hard",
    "question": "The chemical element Lithium is named after the country 
   of Lithuania.",
    "correct_answer": "False",
    "incorrect_answers": [
      "True"
    ]
  },
  {
    "category": "Entertainment: Japanese Anime &amp; Manga",
    "type": "boolean",
    "difficulty": "hard",
    "question": "Druid is a mage class in &amp;quot;Log Horizon&amp;quot;.",
    "correct_answer": "False",
    "incorrect_answers": [
      "True"
    ]
  },
  {
    "category": "Vehicles",
    "type": "boolean",
    "difficulty": "hard",
    "question": "The term &amp;quot;GTO&amp;quot; was originated by Ferrari?",
    "correct_answer": "True",
    "incorrect_answers": [
      "False"
    ]
    }
    ]
    }
  </code></pre>