theme.keycloak.v2.admin.resources.assets.useToggle-K3Kx99tM.js.map Maven / Gradle / Ivy
{"version":3,"file":"useToggle-K3Kx99tM.js","sources":["../../src/utils/useToggle.ts"],"sourcesContent":["import { useCallback, useState } from \"react\";\n\n/**\n * A hook that allows you toggle a boolean value, useful for toggle buttons, showing and hiding modals, etc.\n *\n * @param initialValue The initial value to use, false by default.\n */\nexport default function useToggle(initialValue = false) {\n const [value, setValue] = useState(initialValue);\n const toggleValue = useCallback(() => setValue((val) => !val), []);\n\n return [value, toggleValue, setValue] as const;\n}\n"],"names":["useToggle","initialValue","value","setValue","useState","toggleValue","useCallback","val"],"mappings":"kDAOwB,SAAAA,EAAUC,EAAe,GAAO,CACtD,KAAM,CAACC,EAAOC,CAAQ,EAAIC,EAASH,CAAY,EACzCI,EAAcC,EAAY,IAAMH,EAAUI,GAAQ,CAACA,CAAG,EAAG,CAAA,CAAE,EAE1D,MAAA,CAACL,EAAOG,EAAaF,CAAQ,CACtC"}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy