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

package.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":["useState","useEffect","useStateWithDependency","defaultValue","dependencies","arguments","length","undefined","_useState","_useState2","_slicedToArray","value","setValue"],"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,SAASA,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAE3C,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,GAA0BR,QAAQ,CAACG,YAAY,CAAC;IAAAM,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAzCG,KAAK,GAAAF,UAAA;IAAEG,QAAQ,GAAAH,UAAA;EAEtBR,SAAS,CAAC,YAAM;IACdW,QAAQ,CAACT,YAAY,CAAC;EACxB,CAAC,EAAEC,YAAY,CAAC;EAEhB,OAAO,CAACO,KAAK,EAAEC,QAAQ,CAAC;AAC1B,CAAC;AAED,eAAeV,sBAAsB","ignoreList":[]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy