{"repo":"amrlabib/react-timer-hook","free":true,"listed":false,"github":"https://github.com/amrlabib/react-timer-hook","clone":"git clone https://github.com/amrlabib/react-timer-hook.git","description":"React timer hook","language":"TypeScript","stars":624,"topics":["react","react-hooks","timer","countdown","timers","component","hook","react-native","javascript","stopwatch"],"license":"MIT","category":"mobile-apps","readme_excerpt":"react-timer-hook React timer hook is a custom react hook, built to handle timer, stopwatch, and time logic/state in your react component. 1. useTimer : Timers (countdown timer) 2. useStopwatch : Stopwatch (count up timer) 3. useTime : Time (return current time) --- Setup yarn add react-timer-hook OR npm install --save react-timer-hook --- useTimer - Demo Example Settings key Type Required Description --- --- --- ---- expiryTimestamp Date object YES this will define for how long the timer will be running autoStart boolean No flag to decide if timer should start automatically, by default it is set to true interval number No value to change the interval of the timer, by default it is set to 1000ms. Note: this value will not affect the timer, it will just define the frequency used to calculate the current timer values. For example, if you have a use case where milliseconds are used, you need to use a smaller value for the interval, for example, 20ms or 100ms based on your needs. onExpire Function No callback function to be executed once countdown timer is expired Values key Type Description --- --- ---- milliseconds number milliseconds value, to get accurate ms values you need to set interval to a smaller value example: 20ms seconds number seconds value minutes number minutes value hours number hours value days number days value totalSeconds number total number of seconds left in timer NOT converted to minutes, hours or days totalMilliseconds number total number of milliseconds l","default_branch":null,"files":null,"tree":[],"storefront":"/r/amrlabib","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/amrlabib/react-timer-hook/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}