Socket
Socket
Sign inDemoInstall

use-debounce

Package Overview
Dependencies
3
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 10.0.0-alpha to 10.0.0

2

package.json
{
"name": "use-debounce",
"version": "10.0.0-alpha",
"version": "10.0.0",
"description": "Debounce hook for react",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

@@ -22,2 +22,10 @@ <div align="center">

# useDebounce, useDebouncedCallback & useThrottledCallback
React libraries for debouncing without tears!
- Small size < 1 Kb
- Compatible with underscore / lodash impl — learn once, use everywhere
- Server-rendering friendly!
## Features

@@ -51,5 +59,5 @@

Combining with native event listeners: https://codesandbox.io/s/32yqlyo815
Combining with native event listeners: https://codesandbox.io/s/32yqlyo815
Cancelling, maxWait and memoization: https://codesandbox.io/s/4wvmp1xlw4
Cancelling, maxWait and memoization: https://codesandbox.io/s/4wvmp1xlw4

@@ -114,3 +122,6 @@ HTTP requests: https://codesandbox.io/s/use-debounce-callback-http-y1h3m6

<div>
<input defaultValue={defaultValue} onChange={(e) => debounced(e.target.value)} />
<input
defaultValue={defaultValue}
onChange={(e) => debounced(e.target.value)}
/>
<p>Debounced value: {value}</p>

@@ -222,3 +233,6 @@ </div>

<div>
<input defaultValue={defaultValue} onChange={(e) => debounced(e.target.value)} />
<input
defaultValue={defaultValue}
onChange={(e) => debounced(e.target.value)}
/>
<p>Debounced value: {value}</p>

@@ -259,3 +273,8 @@ <button onClick={debounced.cancel}>Cancel Debounce cycle</button>

return <input defaultValue={defaultValue} onChange={(e) => debounced(e.target.value)} />;
return (
<input
defaultValue={defaultValue}
onChange={(e) => debounced(e.target.value)}
/>
);
}

@@ -272,3 +291,6 @@ ```

function Component({ text }) {
const debounced = useDebouncedCallback(useCallback(() => {}, []), 500);
const debounced = useDebouncedCallback(
useCallback(() => {}, []),
500
);

@@ -325,3 +347,3 @@ expect(debounced.isPending()).toBeFalsy();

| trailing | true | This param executes the function after timeout. | https://github.com/xnimorz/use-debounce#leading-calls |
| equalityFn | (prev, next) => prev === next | [useDebounce ONLY] Comparator function which shows if timeout should be started | |
| equalityFn | (prev, next) => prev === next | [useDebounce ONLY] Comparator function which shows if timeout should be started | |

@@ -328,0 +350,0 @@ ## useThrottledCallback

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc