Sobes.tech
Junior — Senior

Creating a simple timer in React with start and stop buttons

livecode

Task condition

It is necessary to implement a timer component that displays the current counter and has two buttons — "Start" and "Stop". When clicking "Start", the counter begins to increase, and "Stop" stops it.

function Stopwatch() {
    return (
        <div>
            <button>Start</button>
            <button>Stop</button>
            <div>0</div>
        </div>
    );
}

export default function App() {
    return <Stopwatch />;
}