react-clock-component
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

react-clock-component

NPM version Build npm-typescript License

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

Package Sidebar

Install

npm i react-clock-component

Weekly Downloads

3

Version

1.0.2

License

MIT

Unpacked Size

7.94 kB

Total Files

21

Last publish

Collaborators

  • shubh_37