Relative Content

Tag Archive for reactjsasynchronousmemorysetintervalrouter

ReactJS and Router DOM – Memory leak and persisting setInterval of an async function in a useEffect

I’m trying to set up a setInterval in a useEffect for an async function that fetches from a URI. I’m using React Router DOM to set up a few pages for the app. The problem I’m facing is that a memory leak is occurring when using setInterval. I check the devtools performance and memory tabs, and also the browser task manager (ex: in both Edge and Chrome), and the memory being used increases rapidly until the browser errors out on the page with “Out of memory”.