AI

Intervals and subscriptions must be cleaned up! If you don't return a cleanup function from useEffect, multiple intervals will pile up, causing performance issues and erratic behavior.

Your Task:

  • Fix the Timer component where the count speeds up every time you re-render
  • The effect sets an interval but never clears it
  • Return a cleanup function that calls clearInterval
TypeScript Solution
Loading...

Submit your code to see test results