All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.cjs.react-utils.useStateWithDependency.useStateWithDependency.js.map Maven / Gradle / Ivy

Go to download

A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.

There is a newer version: 4.12.3
Show newest version
{"version":3,"file":"useStateWithDependency.js","names":["_react","require","useStateWithDependency","defaultValue","dependencies","arguments","length","undefined","_useState","useState","_useState2","_slicedToArray2","value","setValue","useEffect","_default","exports"],"sources":["../../../../src/react-utils/useStateWithDependency/useStateWithDependency.js"],"sourcesContent":["import { useState, useEffect } from \"react\";\n\nconst useStateWithDependency = (\n  defaultValue,\n  dependencies = [defaultValue]\n) => {\n  const [value, setValue] = useState(defaultValue);\n\n  useEffect(() => {\n    setValue(defaultValue);\n  }, dependencies);\n\n  return [value, setValue];\n};\n\nexport default useStateWithDependency;\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAC1BC,YAAY,EAET;EAAA,IADHC,YAAY,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAACF,YAAY,CAAC;EAE7B,IAAAK,SAAA,GAA0B,IAAAC,eAAQ,EAACN,YAAY,CAAC;IAAAO,UAAA,OAAAC,eAAA,aAAAH,SAAA;IAAzCI,KAAK,GAAAF,UAAA;IAAEG,QAAQ,GAAAH,UAAA;EAEtB,IAAAI,gBAAS,EAAC,YAAM;IACdD,QAAQ,CAACV,YAAY,CAAC;EACxB,CAAC,EAAEC,YAAY,CAAC;EAEhB,OAAO,CAACQ,KAAK,EAAEC,QAAQ,CAAC;AAC1B,CAAC;AAAC,IAAAE,QAAA,GAEab,sBAAsB;AAAAc,OAAA,cAAAD,QAAA"}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy