Create a component that implements a stop timer, allowing users to start, stop, and reset the timer.
MediumProblem Statement
Create a component that implements a stop timer, allowing users to start, stop, and reset the timer.
Sample Input
Initial time: 0
Sample Output
A timer that counts up when started, pauses when stopped, and resets to 0.
Limits
Time: 2s · Memory: 256 MB
Code Editor
Log in to submit00:00
Try your code in this preview. Submit marks it done.
import React, { useState, useEffect } from "react"; const Timer = () => { return ( <div> <p>Time: 0</p> <button>Start</button> <button>Stop</button> <button>Reset</button> </div> ); }; export default Timer;