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

@teneff/react-debounce

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

@teneff/react-debounce

React Debounce Component

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React <Debounce /> Component

Using render props to debounce a callback. Useful for preventing multiple callback executions on scroll, spam-clicking, typing etc.

NPM version Build Status Coverage Status GitHub issues GitHub stars Slack

Install

  • using npm
npm install @teneff/react-debounce
  • using yarn
yarn add @teneff/react-debounce

Live Demo

codesandbox-img

Usage

import Debounce from '@teneff/react-debounce';

class MyComponent extends React.Component {
  handleClick = () => {
    console.info("event handler will be executed once after multiple clicks");
  };

  handleKeyUp = value => {
    console.info("event handler will be executed when you stop typing", value);
  };

  render() {
    return (
      <div>
        <Debounce callback={this.handleClick} delay={300}>
          {onClick => <button onClick={onClick}>click me, wait, profit</button>}
        </Debounce>
        <Debounce callback={this.handleKeyUp} delay={500}>
          {onKeyUp => (
            <input
              type="text"
              onKeyUp={e => onKeyUp(e.target.value)}
              placeholder="Start typing..."
            />
          )}
        </Debounce>
      </div>
    );
  }
}

Keywords

FAQs

Package last updated on 20 May 2019

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc