use-debounce
Advanced tools
Comparing version 10.0.0-alpha to 10.0.0
{ | ||
"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 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
105157
2
380