I am trying to pull just the results from the below API. However it seems to be nested within some data and would like to extract it.
https://opentdb.com/api.php?amount=10000
How can it be done so that I only pull the results and that becomes my 'quizArray' useState?
import './App.css';
const url = 'https://opentdb.com/api.php?amount=10000';
function App() {
const [quizArray, setQuizArray] = useState([]);
const fetchData = async () => {
const response = await fetch(url);
const quiz = response.json();
setQuizArray(quiz);
}
useEffect (() => {
fetchData()
}, [])
console.log(quizArray)
return (
<div className="App">
</div>
);
}
export default App;```