await in useEffect()

Cing Sian Dal
Nov 7, 2020

--

Ok, you see that useEffect() do not accept await syntax.

Solution:

useEffect(()=>{
(async function foo() {
await loadContent();
})();
});

--

--

Cing Sian Dal
Cing Sian Dal

Written by Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.

No responses yet