It initially re-render rather than re-rendering of everytime and you control whether it runs again using the dependency array.

eg:
useEffect(() => {
console.log("Runs only once when the component first loads");
}, []);

-> when specific values change: Put those variables inside the array.
eg:

useEffect(() => {
console.log("Runs on first load, and ONLY when 'userId' changes");
}, [userId]);