1.0.6 • Published 5 years ago

react-use-clock-hook v1.0.6

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

React Hook for sharing clock logic

Install

#With npm
npm install react-use-clock-hook --save 
#With yarn
yarn add react-use-clock-hook

Usage

import React from 'react';
import useClock from 'react-use-clock-hook';

const App = () => {
  const { time, raw } = useClock("HH:mm:ss");

  return (
    <div>
      <div><b>Computer time:</b> {time}</div>
      <div><b>Raw time:</b> {raw.format("dddd, MMMM Do YYYY, h:mm:ss a")}</div>
    </div>
  );
}

export default App;

useClock(<format: String>, <period: Number>)

ParamTypeDefaultDescription
formatString"DD/MM/YYYY HH:mm:ss"Any string accepted by moment.format
periodNumber1000Time, in miliseconds, that the clock is updated

Dependency

moment

License

MIT © alexanderkhivrych

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago