useEffect is Executed in an endless loop react function component
Use of useEffect in React function component is common & frequent. Although useEffect is executed only once per render cycle, but you may have several state updates in your useEffect which cause a re-render. We always need to be careful & make sure we are not consuming too much memory. You can ideally put console.log() inside your useEffect() function and see how many times it is getting printed.