New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-timer-hook-v2

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-timer-hook-v2

`yarn add react-timer-hook-v2` `npm install react-timer-hook-v2`

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

react-timer-hook-v2

Setup

yarn add react-timer-hook-v2 npm install react-timer-hook-v2

Example

import {useTimer} from "react-timer-hook-v2";

function App() {
    // input value only in milliseconds
    const initial_ms = 10000 // 10 sec
    // dd - days
    // hh - hours
    // mm - minutes
    // ss - seconds
    // ms - milliseconds
    // isFinish - show status timer, if timer = 0, isFinish return Boolean true
    // restart - timer reset function
    const {dd, hh, mm, ss, ms, isFinish, restart} = useTimer(initial_ms)

    return (
        <div className="App">
            <h1>
                {hh}:{mm}:{ss}
            </h1>

            <p>{isFinish ? 'timer is finished' : 'timer is running'}</p>

            <button onClick={restart}>Restart</button>
        </div>
    );
}

export default App;

Description

When the timer is set to 0, all calculations and calls finished.

Keywords

timer

FAQs

Package last updated on 27 Jul 2023

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