I can call a fetch
method with .then
directly in an effect. But I can’t do this:
useEffect(async () => {});
Warning by react
Why are async
/await
rejected in React’s useEffect
, whereas promises with .then()
are accepted?
1
I can call a fetch
method with .then
directly in an effect. But I can’t do this:
useEffect(async () => {});
Warning by react
Why are async
/await
rejected in React’s useEffect
, whereas promises with .then()
are accepted?
1