Concept
In development, StrictMode mounts each component, runs its effects, cleans them up and runs them again. It is React checking that your cleanup really undoes your effect; in production it runs once.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show StrictMode double effects doing its job.
useEffect(() => {
const socket = connect(roomId); // runs, is cleaned up, runs again
socket.on("message", addMessage);
return () => socket.close(); // without this, two live sockets
}, [roomId]);
// Correct cleanup makes the double run harmless.Removing StrictMode to make a duplicated request or subscription "go away". The duplication is the symptom of a missing cleanup, which will also bite when roomId changes in production.
Your roadmap puts these before StrictMode double effects, unless you already know them.
Once a session shows you understand StrictMode double effects, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
What you are asked on review day.
Why does useEffect run twice in development with StrictMode?
React mounts, unmounts and remounts components to surface effects that are missing cleanup. It only happens in development.