1.0.2 • Published 5 years ago

rax-use-countdown v1.0.2

Weekly downloads
6
License
BSD-3-Clause
Repository
github
Last release
5 years ago

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.

TypeDescription
startnumberStart time
entnumberEnd 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>;
}