One of useEffect's uses is to perform an effect when a component is first mounted, and not to repeat it. However, React's compiler always breathes down your neck about adding dependencies to useEffect's dependency array. Most of the time, sure, the dependencies don't change, so it makes no difference. Sometimes it does.
Today I solved this issue by offloading some of the work that I wanted the useEffect to do into a custom hook. More as a reminder to myself, I want to note - it's a definite solution you can use.