1.0.1 • Published 2 years ago

hexi-hooks v1.0.1

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

hexi-hooks

Getting Started

Install dependencies,

$ yarn add hexi-hooks

Demo

import React from 'react';
import hooks from 'hexi-hooks';
const { useTimeCountDown } = hooks;
const endDate = new Date('2022-12-16 11:00:00 GMT+0800').getTime();
export default () => {
  const { leftDays, leftHours, leftMinutes, leftSeconds, isOutOfDate } = useTimeCountDown(
    endDate,
    1000,
  );
  return (
    <div>
      <div>
        {leftDays} days {leftHours} hours {leftMinutes} mins {leftSeconds} secs left
      </div>
      <br />
      <div>is out of date: {String(isOutOfDate)}</div>
    </div>
  );
};