NovFora Dev

**Can anyone help me debug my React useEffect? It keeps running on every render.**

Taylor Davis

Taylor Davis

4 months ago

I'm trying to fetch data when a component mounts but it re-runs constantly. I suspect I forgot the dependency array or included something that changes on every render. Any advice would be appreciated!

Owen Martin

Owen Martin

4 months ago

You need to add a dependency array as the second argument. If you omit it, the effect

Join the conversation to leave a reply.

Sign in to reply

Related topics