use-debounce
Advanced tools
Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "use-debounce", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Debounce hook for react", | ||
@@ -26,4 +26,4 @@ "main": "lib/index.js", | ||
"peerDependencies": { | ||
"react": ">=16.7.0-alpha.0", | ||
"react-dom": ">=16.7.0-alpha.0" | ||
"react": ">=16.8.0", | ||
"react-dom": ">=16.8.0" | ||
}, | ||
@@ -39,5 +39,5 @@ "homepage": "https://github.com/xnimorz/use-debounce#readme", | ||
"jest": "^23.6.0", | ||
"react": "^16.7.0-alpha.0", | ||
"react-dom": "^16.7.0-alpha.0" | ||
"react": "^16.8.0", | ||
"react-dom": "^16.8.0" | ||
} | ||
} |
@@ -6,16 +6,13 @@ import { useState, useEffect } from 'react'; | ||
useEffect( | ||
() => { | ||
const handler = setTimeout(() => { | ||
setDebouncedValue(value); | ||
}, delay); | ||
useEffect(() => { | ||
const handler = setTimeout(() => { | ||
setDebouncedValue(value); | ||
}, delay); | ||
return () => { | ||
clearTimeout(handler); | ||
}; | ||
}, | ||
[value, delay] | ||
); | ||
return () => { | ||
clearTimeout(handler); | ||
}; | ||
}, [value, delay]); | ||
return debouncedValue; | ||
}; |
Sorry, the diff of this file is not supported yet
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
196080
95