UNPKG

use-state-debounced

Version:

useStateDebounced - React debounced state hook

3 lines (2 loc) 253 B
import{useState as t,useEffect as r}from"react";function e(e,o){const[n,c]=t(o),[u,i]=t(n);return r(()=>{const t=setTimeout(()=>i(n),e);return()=>{clearTimeout(t)}},[n,e]),[n,u,c]}export{e as useStateDebounced}; //# sourceMappingURL=index.modern.js.map