useBoolean

Custom hook that handles boolean state with useful utility functions.

Custom hook that handles boolean state with useful utility functions.

Usage

import { useBoolean } from "@tilt-legal/cubitt-components/utilities/hooks";

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

API

Signature

declare function useBoolean(defaultValue?: boolean): UseBooleanReturn;

Parameters

ParameterTypeDescriptionDefault
[defaultValue]booleanThe initial value for the boolean state .false

Return Value

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

On this page