error TS1308: ‘await’ expressions are only allowed within async functions and at the top levels of modules.ts.
Broken Code ❌
Fixed Code ✔️
You cannot use an
await expression in an
useEffect hook, but you can use legacy Promise calls:
Alternatively, you can use an IIFE (Immediately-invoked Function Expression) in your