DEV Community

Discussion on: How to use async function in useEffect?

Collapse
 
hbgl profile image
hbgl

Using async from within hooks is completely fine. Yes, it is true that using a hook may not always be the best choice and that you should generally avoid them. However when you need to use an effect and when you need to do something asynchronously, then you should put your async code into the effect handler.