Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
{"version":3,"file":"useToggle-3764a2a4.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":"wCAOwB,SAAAA,EAAUC,EAAe,GAAO,CACtD,KAAM,CAACC,EAAOC,CAAQ,EAAIC,WAASH,CAAY,EACzCI,EAAcC,EAAY,YAAA,IAAMH,EAAUI,GAAQ,CAACA,CAAG,EAAG,CAAA,CAAE,EAE1D,MAAA,CAACL,EAAOG,EAAaF,CAAQ,CACtC"}