Good day everyone… I’m a Angular senior developer who’s working on a new React App (I’m learning on the way). There’s a concept I think I don’t understand.
Sitemap: Dashboard > lead page
When I’m from the dashboard and I visit the lead page, as this code suggest, the useEffect() hook does its job and triggers the refreshPage() but if I go back and forth, the lead page api calls pilles up… from 2 to 4, 6, etc.
Please note: The dashboard page have the same useEffect() but as you can see from the screenshot doesn’t pile up requests.
From what I can understand there’s 2 possibilities:
1- The anonymous function inside useEffect() stays in memory and never get released
2- Something in the page stays in memory and triggers useEffect()
How can I resolve this?