useBoolean
Custom hook that handles boolean state with useful utility functions.
Installation
npx sse-tool add use-boolean
npm install sse-hooks
Usage
import { useBoolean } from "./{hooks file}";
const { value, setTrue, setFalse, toggle } = useBoolean(true);
import { useBoolean } from "sse-hooks";
const { value, setTrue, setFalse, toggle } = useBoolean(true);
API
Parameters
| Name | Type | Description |
|---|---|---|
| defaultValue | boolean | The initial value for the boolean state (default is false). |
Return Value
Returns UseBooleanReturn.
An object containing the boolean state value and utility functions to manipulate the state.