package.cjs.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":["_react","require","useDebounce","value","delay","arguments","length","undefined","_useState","useState","_useState2","_slicedToArray2","debouncedValue","setDebouncedValue","useEffect","handler","setTimeout","clearTimeout","_default","exports"],"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,IAAAA,MAAA,GAAAC,OAAA;AAEA,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,GAA4C,IAAAC,eAAQ,EAACN,KAAK,CAAC;IAAAO,UAAA,OAAAC,eAAA,aAAAH,SAAA;IAApDI,cAAc,GAAAF,UAAA;IAAEG,iBAAiB,GAAAH,UAAA;EAExC,IAAAI,gBAAS,EAAC,YAAM;IACd,IAAMC,OAAO,GAAGC,UAAU,CAAC,YAAM;MAC/BH,iBAAiB,CAACV,KAAK,CAAC;IAC1B,CAAC,EAAEC,KAAK,CAAC;IAET,OAAO,YAAM;MACXa,YAAY,CAACF,OAAO,CAAC;IACvB,CAAC;EACH,CAAC,EAAE,CAACZ,KAAK,CAAC,CAAC;EAEX,OAAOS,cAAc;AACvB,CAAC;AAAC,IAAAM,QAAA,GAEahB,WAAW;AAAAiB,OAAA,cAAAD,QAAA"}