← Back to Challenge

Countdown Timer

Build a countdown timer with start, pause, and reset controls. The helper function and constants are ready — implement the timer logic using setInterval and refs.

05:00

Adjust starting time

:

Store the interval ID in a useRef (not state) to avoid re-renders. Use setTimeLeft(prev => prev - 1) inside the interval to avoid stale closures. Remember to clearInterval on pause, reset, and component unmount. Check the TODOs in the code.