use-deeebounce
A React hook for debouncing values in functional components.
Installation
You can install the package using npm:
yarn add use-deeebounce
npm install use-deeebounce
Usage
import React, { useState } from 'react';
import { useDebounce } from 'use-deeebounce';
export const Input = () => {
const [inputValue, setInputValue] = useState('');
const debouncedInputValue = useDebounce(inputValue, 5 * 100);
return (
<div>
<label>Input:</label>
<input type="text" value={inputValue} onChange={(e)=>setInputValue(e.target.value)} />
{/* see the debounced query here */}
<p>Debounced Value: {debouncedInputValue}</p>
</div>
);
};