Socket
Book a DemoInstallSign in
Socket

@maxwellsr/react-debouncer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maxwellsr/react-debouncer

A Simple React hook to debounce any function call

1.0.5
latest
Source
npmnpm
Version published
Weekly downloads
19
-94.26%
Maintainers
1
Weekly downloads
 
Created
Source

⏲️ React Debouncer

A custom React hook for debouncing function execution, helping you optimize performance by limiting how often a function is called in response to rapid user actions.

What is debouncing

Debouncing postpones a function’s execution until after a pause in activity, ensuring it runs only once after rapid, repeated calls stop.

Installing & Using

npm install @maxwellsr/react-debouncer

Suppose you want to implement an instant search feature, similar to how Google suggests results as you type. You don't want to trigger an API call with every keystroke, as this would be inefficient and could overload your backend.

Instead, you can debounce the text input's change event so that the search function is only called after the user has stopped typing for a short period.

// import the debouncer
import { debouncer } from "@maxwellsr/react-debouncer";

...
// this is your component
const MyComponent = () => {

    // instance the debouncer, this function accept and integer value
    // for delaying function call, delay=500 by default
    const debounce = debouncer();

    return (
        <section>
          <SearchInput
            onChange={(value) => {
              // call our debouncer with every key pressed
              debounce(() => {
                // function that you will really debounce
                performSearch(value);
              });
            }}
          />
        </section>
    )

}

Keywords

react

FAQs

Package last updated on 27 Aug 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.