Facebook Pixel

Stopwatch

React.js
medium
30 mins

Build a simple stopwatch with Start, Stop, and Reset functionality. The stopwatch should display elapsed time in seconds and update every second while running.

Requirements

  • Display a timer starting at 0.
  • Include three buttons: Start, Stop, and Reset.
  • On clicking Start, the timer should begin incrementing every second.
  • Stop should pause the timer.
  • Reset should stop the timer and reset it back to 0.
  • Ensure the timer doesn’t increment multiple times if Start is clicked repeatedly.

Constraints & Edge Cases

  • Timer should not increment if already running and Start is clicked again.
  • After Reset, the timer should show 0 and stop ticking.
  • Stop should not reset the time.
  • Memory leaks must be avoided when using intervals.

Reference UI

stopwatch

Preview what you need to build

Companies:

uber
ola

Solve Similar questions 🔥

Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.
Please Login.