This is the code snippet:
useEffect(() => {
async function fetchData() {
const url = 'https://api.randomuser.me';
const response = await fetch(url);
console.log('response: ', response);
}
fetchData();
}, []);
as you can see, it is an useEffect hook, calling a public API for some data, using async await in order to wait for the response.
But the logged data isn't containing what it should.
This is in console.log:
body: ReadableStream
bodyUsed: false
headers: Headers {}
ok: true
redirected: false
status: 200
statusText: ""
type: "cors"
url: "https://api.randomuser.me/"
__proto__: Response
what's wrong?