InterviewBuddy
All interview questions

What should an effect cleanup do?

Beginner

Answer

Cleanup should undo what setup did, such as unsubscribing, clearing a timer, or disconnecting. It runs before relevant reruns and on unmount.