1.0.2 • Published 5 years ago
rax-use-countdown v1.0.2
rax-use-countdown
A countdown hooks which will return the left days/hours/minutes/seconds state.
Install
$ npm install rax-use-countdown --save
API
The API will recevie two params -- start
/end
.
Type | Description | |
---|---|---|
start | number | Start time |
ent | number | End time |
Example
import { createElement } from 'rax';
import useCountDown from 'rax-use-countdown';
function Example() {
const now = Date.now();
const { days, hours, minutes, seconds } = useCountDown(now, now - 10000000);
return <div>There only left {days}days {hours}hours {minutes}minutes {seconds}seconds</div>;
}