New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-clock-interval

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-clock-interval

Almost accurate clock component for react

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

react-clock-interval

🕰 Almost accurate clock component for react

This component implements the setInterval logic to render a clock and prevent the following issues:

  • Skip some seconds
  • Not on sync with system clock

Features

  • Works on react-dom and react-native (it should work on other renderers too)
  • You can render it whatever you like
  • TypeScript support

Install

npm

npm install react-clock-interval

yarn

yarn add react-clock-interval

API

PropTypeRequiredDescription
childrenfunctionA render prop that will give you the current date and you can render it whatever you like.
initialDateTimeDateBy default, the clock provides the system date. If you wish to start on some specific date instead, set it on this prop.
forceUpdateInitialDateTimebooleanForces the clock time to update.

Example

import React from 'react';
import Clock from 'react-clock-interval';

class Example extends React.Component {
  render() {
    return (
      <Clock>
        {dateTime => <div>{dateTime.toString()}</div>}
      </Clock>
    );
  }
}

Thanks

  • https://taylorhakes.com/posts/creating-a-clock-with-setinterval/

FAQs

Package last updated on 02 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc