@arvind-yadav/use-debounce
v1.0.1
Published
A lightweight React hook and vanilla JS utility to debounce values and function calls.
Maintainers
Readme
@arvind-yadav/use-debounce
A lightweight React hook and vanilla JS utility to debounce values and function calls.
Installation
npm install @arvind-yadav/use-debounceUsage
React Hook
import { useDebounce } from '@arvind-yadav/use-debounce';
const debouncedSearchTerm = useDebounce(searchTerm, 500);Vanilla JS Function Debounce
import { debounce } from '@arvind-yadav/use-debounce';
const handleInput = debounce((val) => {
console.log(val);
}, 300);