README
use-seconds
Seconds interval time for React
this timer is Keep adjusting setTimeout
timing and return adjusted Time.
10.995 s → return 11.000 s
↓ setTimeout 1005 (ms)
12.003 s → return 12.000 s
↓ setTimeout 997 (ms)
DEMO use-seconds-example - CodeSandbox
Install
npm install --save use-seconds
Usage
import * as React from "react";
import { useSeconds } from "use-seconds";
const Example = () => {
const [date] = useSeconds(); // Date object
return <td>{String(date.getSeconds())}</td>;
};
License
MIT © elzup
This hook is created using create-react-hook.