⚛ React Tips - You're misusing the React useEffect hook (probably)
This is def one of the most common mistakes I've seen in both personal and enterprise applications.
The useEffect hook exists to sync an external system (i.e. network, DOM) to your React application. That means when you're useEffect'ing to:
1. Adjust state or props when a certain value changes (in state or props)
2. Replicate legacy class based lifecycle methods
you're just doing it wrong.
With awesome packages like TanStack Query (React Query) & SWR you don't even need a useEffect to fetch data.
If you want to learn more about useEffect check out the new beta documentation on it: https://beta.reactjs.org/learn/you-might-not-need-an-effect (opens in a new tab)