use-debounce-fn-react
v1.0.0
Published
Lightweight React 18 & 19 hook providing useDebounce value, debounced callback, and throttled execution with flush and cancel support.
Maintainers
Readme
⏱️ use-debounce-fn-react
Lightweight React 18 & 19 hook providing useDebounce value, debounced callback, and throttled execution with flush and cancel support.
🚀 Quick Start
import React, { useState } from 'react';
import { useDebounce, useDebouncedCallback } from 'use-debounce-fn-react';
export function SearchInput() {
const [text, setText] = useState('');
// 1. Debounced value
const debouncedSearch = useDebounce(text, 500);
// 2. Debounced API function
const { run: sendApi } = useDebouncedCallback((query: string) => {
console.log('Searching API for:', query);
}, 400);
return (
<input
value={text}
onChange={(e) => {
setText(e.target.value);
sendApi(e.target.value);
}}
/>
);
}💖 Support the Project
If you find this package useful, consider sponsoring its ongoing development: 👉 Sponsor @Piratha97 on GitHub Sponsors
📄 License
MIT © 2026 Pirapaakaran Pirathapan
