DEV Community

Discussion on: "Synchronous" fetch with async/await

Collapse
 
johnpaulada profile image
John Paul Ada • Edited

ahh the function wrapping that should also be async, so it should be like:

const useRequest = async () => {
  const res = await request()
}

useRequest()

given that you return the json instead of just logging it in the request() function.

Collapse
 
mindyzwan profile image
Mindy Zwanziger

Exactly what I needed to know too - thanks!