package.react-utils.useUpdateEffect.useUpdateEffect.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":"useUpdateEffect.js","names":["useEffect","useRef","useUpdateEffect","callback","dependencies","arguments","length","undefined","isInitialMount","current"],"sources":["../../../src/react-utils/useUpdateEffect/useUpdateEffect.js"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\nconst useUpdateEffect = (callback, dependencies = []) => {\n const isInitialMount = useRef(true);\n\n useEffect(() => {\n if (isInitialMount.current) {\n isInitialMount.current = false;\n\n return;\n }\n callback();\n }, dependencies);\n};\nexport default useUpdateEffect;\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAEzC,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAIC,QAAQ,EAAwB;EAAA,IAAtBC,YAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,EAAE;EAClD,IAAMG,cAAc,GAAGP,MAAM,CAAC,IAAI,CAAC;EAEnCD,SAAS,CAAC,YAAM;IACd,IAAIQ,cAAc,CAACC,OAAO,EAAE;MAC1BD,cAAc,CAACC,OAAO,GAAG,KAAK;MAE9B;IACF;IACAN,QAAQ,EAAE;EACZ,CAAC,EAAEC,YAAY,CAAC;AAClB,CAAC;AACD,eAAeF,eAAe"}