I am using useEffect with an empty dependency array , but it runs more than once, my goal is to fetch data from API only when component mounts. why does this happen in React and how can i ensure the API is called only once.
I am using useEffect with an empty dependency array , but it runs more than once, my goal is to fetch data from API only when component mounts. why does this happen in React and how can i ensure the API is called only once.