Q. What does the useEffect hook’s cleanup function do?

  • (A) Runs when the component unmounts or before re-running the effect
  • (B) Sets initial state
  • (C) Updates props
  • (D) Fetches data
πŸ’¬ Discuss
βœ… Correct Answer: (A) Runs when the component unmounts or before re-running the effect
Explanation: Cleanup helps avoid memory leaks and stale subscriptions.
Explanation by: Mr. Dubey
Cleanup helps avoid memory leaks and stale subscriptions.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
70
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
93%
Success Rate