1.0.2 • Published 7 months ago

react-clock-component v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

react-clock-component

NPM version Build npm-typescriptLicense]github-license-url

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...

Live Demo

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>,
)