useDebounceValue

Custom hook that returns a debounced version of the provided value, along with a function to update it.

Usage

import { useDebounceValue } from "@tealess/hooks";
export default function Component({ defaultValue = "John" }) {
const [debouncedValue, setValue] = useDebounceValue(defaultValue, 500);
return (
<div>
<p>Debounced value: {debouncedValue}</p>
<input type="text" defaultValue={defaultValue} onChange={(event) => setValue(event.target.value)} />
</div>
);
}