DEV Community

Discussion on: React useEffect fetching API

Collapse
ryelbanfield profile image
Ryel Banfield

Appreciate the awesome tutorial dude! However your fetch would end up in an endless loop. To run the fetch just once you would want to leave your useEffect dependency empty. 😊👍

Collapse
shubhamtiwari909 profile image
ShubhamTiwari909 Author

But when I leave it empty it throws error of empty dependency