1.0.1 • Published 1 year ago

react-cool-timer v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-cool-timer

React timer countdown hook with easy to use API .

Installation

$ npm install --save react-cool-timer

or

yarn add react-cool-timer

or

pnpm add react-cool-timer

Usage

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

NameTypeDefaultDescription
onEndReached() => voidnullSets a function to run after timer ends
timeIntervalnumberREQUIREDSets time interval in seconds

Developer

@1mehdifaraji