Create a Basic Stopwatch in React — HH:MM:SS Formatted Timer with Start Pause Resume and Reset Controls
Build a basic stopwatch in React with a display in HH:MM:SS format and four controls: Start, Pause, Resume, and Reset. Maintain two state values — a running boolean and a currentTime counter (total elapsed seconds). Use useRef to hold the setInterval timer reference so it can be cleared without re-renders. On Start: set running to true and begin interval. On Pause: clear interval and set running to false. On Resume: restart interval from current time. On Reset: clear interval, set both states back to zero. Format elapsed seconds into HH:MM:SS using modulo arithmetic. Use inline styles to keep it simple and fast. This was asked in xAI (Twitter) for the Frontend Engineering Specialist position within a 30-minute constraint.