one-hook
Size
0.33 kb
View source

useTimeout

setTimeout, reactified.

Installation

npm install @1hook/use-timeout

Usage

import {  } from '@1hook/use-timeout'

Set a timeout:

const { , ,  } = (() => {
  .('Hello')
}, 1000)

Pause the timeout by setting the delay to null:

(() => .('Hello'), null)

API Reference

UseTimeoutReturn

The return value of the useTimeout hook.

PropTypeDefault
reset
() => void
-
cancel
() => void
-
isPending
boolean
-

On this page