react-cool-timer
v1.0.1
Published
React timer countdown hook
Maintainers
Readme
react-cool-timer
React timer countdown hook with easy to use API .
Installation
$ npm install --save react-cool-timeror
yarn add react-cool-timeror
pnpm add react-cool-timerUsage
import { useTimer } from "react-cool-timer";
export const App = () => {
const { timeLeft } = useTimer({
onEndReached: () => console.log("Reached end"),
timeInterval: 20,
});
return <div>Timeleft : {timeLeft}</div>;
};Available props
| Name | Type | Default | Description |
| ------------ | ------------ | ------------ | --------------------------------------- |
| onEndReached | () => void | null | Sets a function to run after timer ends |
| timeInterval | number | REQUIRED | Sets time interval in seconds |
