@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
26 lines (22 loc) • 768 B
JavaScript
"use client";
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
let react = require("react");
react = require_rolldown_runtime.__toESM(react);
//#region src/hooks/use-boolean/index.ts
/**
* `useBoolean` is a custom hook used to manage boolean values using `on`, `off`, and `toggle` functions.
*
* @see https://yamada-ui.com/docs/hooks/use-boolean
*/
const useBoolean = (init = false) => {
const [flg, setFlg] = (0, react.useState)(init);
const on = (0, react.useCallback)(() => setFlg(true), []);
return [flg, {
off: (0, react.useCallback)(() => setFlg(false), []),
toggle: (0, react.useCallback)(() => setFlg((prev) => !prev), []),
on
}];
};
//#endregion
exports.useBoolean = useBoolean;
//# sourceMappingURL=index.cjs.map