@mozart25/react-timer
v1.0.1
Published
A customizable React timer component.
Downloads
2
Readme
@mozart25/react-timer
A customizable React timer component.
Installation
You can install this package via npm:
npm install @mozart25/react-timer
Usage
import React from "react";
import Stopwatch from "@mozart25/react-timer";
const CustomStopwatch = () => {
return (
<Stopwatch
renderContainer={(children) => (
<div style={{ border: "2px solid black", padding: "20px" }}>
{children}
</div>
)}
renderDisplay={(formattedTime) => <h1>{formattedTime}</h1>}
renderControls={({ start, stop, reset }) => (
<div>
<button onClick={start}>Start</button>
<button onClick={stop}>Stop</button>
<button onClick={reset}>Reset</button>
</div>
)}
/>
);
};
License
MIT