New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

use-debouncy

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-debouncy

React effect hook for debounce


Version published
Maintainers
1
Created

useDebouncy

🚦React effect hook for debounce.

license dependents types

Features

  • 👌 No dependencies.
  • 🏋️‍♀️ Small. <200 bytes. Size Limit controls the size.
  • 📖 Types. Support typescript.
  • 🎣 Easy. Like useEffect hook.

Installation

# NPM
npm install use-debouncy

# YARN
yarn add use-debouncy

Examples

Try in codesandbox

import React, { useState } from 'react';
import useDebouncy from 'use-debouncy';

const App = () => {
  const [value, setValue] = useState('');

  useDebouncy(
    () => fetchData(value), // function debounce
    400, // number of milliseconds to delay
    [value], // array values that the debounce depends (like as useEffect)
  );

  return (
    <input value={value} onChange={(event) => setValue(event.target.value)} />
  );
};

FAQs

Package last updated on 23 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts