UNPKG

use-state-debounced

Version:

useStateDebounced - React debounced state hook

3 lines (2 loc) 298 B
import{useState as r,useEffect as t}from"react";function n(n,e){var o=r(e),u=o[0],i=o[1],c=r(u),f=c[0],a=c[1];return t(function(){var r=setTimeout(function(){return a(u)},n);return function(){clearTimeout(r)}},[u,n]),[u,f,i]}export{n as useStateDebounced}; //# sourceMappingURL=index.module.js.map