1.0.0 • Published 3 years ago

react-debounce-effect v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

react-debounce-effect

React use effect hook but with debounce

Install

npm install react-debounce-effect

Usage

import React from "react"
import useDebounceEffect from 'react-debounce-effect'

const callback = React.useCallback(() => {
    // do something
}, [])

useDebounceEffect(callback, 600)

API

Parameters

callback

type (...args: any[]) => void

This is the function that will be called when the timeout occurs. Make sure you memoize the function declaration using React.useCallback

ms

type number

the number of milliseconds that the debounce will occurs