Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/netzo/deps/usehooks-ts.ts>useBoolean

Full-stack Deno framework for building business web apps like internal tools, dashboards, admin panels and automated workflows.
Go to Latest
function useBoolean
import { useBoolean } from "https://deno.land/x/netzo@0.4.72/deps/usehooks-ts.ts";

Custom hook for handling boolean state with useful utility functions.

Examples

const { value, setTrue, setFalse, toggle } = useBoolean(true);

console.log(value); // true setFalse(); console.log(value); // false toggle(); console.log(value); // true

Parameters

optional
defaultValue: boolean
  • The initial value for the boolean state (default is false).

Returns

UseBooleanOutput

An object containing the boolean state value and utility functions to manipulate the state.