red
redebounce
npm i redebounce
red

redebounce

↘️ Render Props component to debounce the given value

by Kohei

0.2.0 (see all)License:MITTypeScript:Built-In
npm i redebounce
Readme

Redebounce

npm GitHub stars GitHub license

Render Props component to debounce the given value.

  • 🚀 Dependency free
  • 🏄‍ Extremely tiny
  • 🔌 Plug and Play
  • 👷 Well tested
  • 👔 Built with TypeScript

Example

TRY IT OUT HERE

Redebounce Example

Install

npm i -S redebounce

APIs

<Redebounce>

Props

NameTypeRequiredDescription
dueTimenumberThe timeout duration in milliseconds for the window of time to wait stopping changes of value and provide it to children
valueTThe value to provide to children.
children(value: T) => ReactNodeA render props function which provides the value from value

Usage

import Redebounce from 'redebounce';

class WaitFor600ms extends PureComponent {
  state = { value: '' };

  render() {
    return (
      <div>
        <input onChange={this.onChangeInput} />

        <Redebounce dueTime={600} value={this.state.value}>
          {value => <input value={value} />}
        </Redebounce>
      </div>
    );
  }

  onChangeInput = e => {
    this.setState({ value: e.currentTarget.value });
  };
}

License

MIT

Contribute

You can help improving this project leaving Pull requests and helping with Issues.

Downloads/wk

7

GitHub Stars

14

LAST COMMIT

4yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
0.2.0
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial