Socket
Book a DemoInstallSign in
Socket

react-hook-timeout

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-hook-timeout

A component of React Hook based on setTimeout and clearTimeout that supports multi-timeout management.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

react-hook-timeout

A component of React Hook based on setTimeout and clearTimeout that supports multi-timeout management.

Install

Using npm

npm install react-hook-timeout --save-dev

Usage

ESM usage

import useTimeout from 'react-hook-timeout';

export default function myComponent() {
    const { setTimeout } = useTimeout();
    setTimeout(() => {
        //delay doing something after 5 seconds
    }, 5000);
}

Description

This hook component supports to remove all timeout automatically when component uninstalled.

Method

setTimeout(callback, delay)

  • callback => {Function} The callback function for the timeout response.(required)
  • delay => {Number} Delay time.(required)
  • return value => {Number} Timeout ID

clearTimeout(id)

  • id => {Number} Timeout ID.(required)

License

react-hook-timeout is MIT licensed.

Keywords

react

FAQs

Package last updated on 24 May 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.