DEV Community

loading...

Discussion on: 💡 React Hooks: async function in the useEffect

Collapse
amn3s1a2018 profile image
Amn3s1a2018

There is an useAsyncEffect custom hook. (Out there in some npm package) The cleanup function is passed in a separate parameter, so it doesn't share the full scope of the effect function, like it does in the original useEffect hook.
You may write your own if that option is more pleasant.

Forem Open with the Forem app