package.react-utils.useDebounce.useDebounce.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"useDebounce.js","names":["useState","useEffect","useDebounce","value","delay","arguments","length","undefined","_useState","_useState2","_slicedToArray","debouncedValue","setDebouncedValue","handler","setTimeout","clearTimeout"],"sources":["../../../src/react-utils/useDebounce/useDebounce.js"],"sourcesContent":["import { useState, useEffect } from \"react\";\n\nconst useDebounce = (value, delay = 350) => {\n const [debouncedValue, setDebouncedValue] = useState(value);\n\n useEffect(() => {\n const handler = setTimeout(() => {\n setDebouncedValue(value);\n }, delay);\n\n return () => {\n clearTimeout(handler);\n };\n }, [value]);\n\n return debouncedValue;\n};\n\nexport default useDebounce;\n"],"mappings":";AAAA,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,IAAMC,WAAW,GAAG,SAAdA,WAAWA,CAAIC,KAAK,EAAkB;EAAA,IAAhBC,KAAK,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,GAAG;EACrC,IAAAG,SAAA,GAA4CR,QAAQ,CAACG,KAAK,CAAC;IAAAM,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAApDG,cAAc,GAAAF,UAAA;IAAEG,iBAAiB,GAAAH,UAAA;EAExCR,SAAS,CAAC,YAAM;IACd,IAAMY,OAAO,GAAGC,UAAU,CAAC,YAAM;MAC/BF,iBAAiB,CAACT,KAAK,CAAC;IAC1B,CAAC,EAAEC,KAAK,CAAC;IAET,OAAO,YAAM;MACXW,YAAY,CAACF,OAAO,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,CAACV,KAAK,CAAC,CAAC;EAEX,OAAOQ,cAAc;AACvB,CAAC;AAED,eAAeT,WAAW","ignoreList":[]}