Implement a useCountdown hook that manages a countdown.

exportdefaultfunction Component() {
const { count, start, stop, reset } = useCountdown({ countStart: 10 });
return (
    <div>
      <p>Countdown: {count}</p>
      <button onClick={start}>Start</button>
      <button onClick={stop}>Stop</button>
      <button onClick={reset}>Reset</button>
    </div>
  );
}

Arguments

The hook accepts an object with the following properties:

Returns

The hook returns an object with the following properties:

Editorial