@aakashx2838/use-debounce
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

Use Debounce

A simple React hook to debounce a state value.

Installation

npm install @aakashx2838/use-debounce

# or

yarn add @aakashx2838/use-debounce

Usage

import { useDebounce } from "@aakashx2838/use-debounce";

const [value, setValue] = useState("");
const debouncedValue = useDebounce(value, 500);

return (
  <div>
    <input
      type="text"
      value={value}
      onChange={(e) => setValue(e.target.value)}
    />
    <p>Debounced value: {debouncedValue}</p>
  </div>
);

Defaults

debounceTime = 500; // ms

/@aakashx2838/use-debounce/

    Package Sidebar

    Install

    npm i @aakashx2838/use-debounce

    Weekly Downloads

    1

    Version

    1.0.5

    License

    MIT

    Unpacked Size

    7.73 kB

    Total Files

    11

    Last publish

    Collaborators

    • aakashx2838