#531 Stopwatch

medium
react
ui-coding

Create a stopwatch component that tracks elapsed time. It should display the current timer and provide two buttons: Start/Stop and Reset.

Specifications

  • Start/Stop: Toggles the stopwatch between running and paused states.
  • Reset: Stops the stopwatch and resets the time to zero.
  • Display: Show elapsed time in seconds with millisecond precision.
  • Click-to-Toggle: Clicking the timer itself should also start/stop the stopwatch, with the button label updating to match the state.
  • Format the display as hh:mm:ss:ms.