Socket
Socket
Sign inDemoInstall

react-hook-timeout

Package Overview
Dependencies
3
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

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.


Version published
Weekly downloads
3
Maintainers
1
Install size
7.09 kB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 24 May 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc