react-clock-component
v1.0.2
Published
This library helps you to display clock on your application without any hassle
Downloads
25
Maintainers
Readme
react-clock-component
This repo holds a library that allows you to display real time clock on your application without any hassle.
First step is to specify the format in which you want to display the clock as one of the props.
Check out the various format from moment(https://momentjscom.readthedocs.io/en/latest/moment/04-displaying/01-format/) and pass it as it.
Second step is to pass a delay timer as one of the props in order to refresh your clock.
And now you're good to go...
Installation:
npm install react-clock-component --save-dev
or
yarn add -D react-clock-component
Usage :
Add Clock
to your component:
import React from 'react'
import ReactDOM from 'react-dom/client'
import { Clock } from 'react-clock-component'
const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
<div>
<h2>Default clock</h2>
<Clock format='LL' delayTimer={1000}/>
</div>
<hr />
<div>
<h2>Clock with predefined value</h2>
<Clock format='LL' delayTimer={1000} />
</div>
</React.StrictMode>,
)