2.1.2 • Published 6 years ago

react-use-stopwatch v2.1.2

Weekly downloads
8
License
MIT
Repository
gitlab
Last release
6 years ago

react-use-stopwatch

A React Stopwatch Hook

Installation

npm install react-hook-stopwatch
yarn add react-hook-stopwatch

Usage

import { useStopwatch } from "react-hook-stopwatch";

export const Stopwatch = () => {
  const [{ time, format }, start, stop, reset] = useStopwatch();

  return (
    <div>
      // Stopwatch Outputs
      <strong>{time}</strong>
      <strong>{format}</strong>
      // Stopwatch Inputs
      <button onClick={() => start()}>Start</button>
      <button onClick={() => stop()}>Stop</button>
      <button onClick={() => reset()}>Reset</button>
    </div>
  );
};
Output: 87660 // Milliseconds
Output: 00:01:27.66 // HH:mm:ss:ms
2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.0

6 years ago