Q. What does the useEffect hook’s cleanup function do?
β
Correct Answer: (A)
Runs when the component unmounts or before re-running the effect
Explanation: Cleanup helps avoid memory leaks and stale subscriptions.