import { useState, useCallback } from 'react'; /** * Return type for useToggle hook */ export interface UseToggleReturn { /** * Current boolean value */ value: boolean; /** * Toggle the value */ toggle: () => void; /** * Set value to true */ setTrue: () => void; /** * Set value to false */ setFalse: () => void; /** * Set value directly */ setValue: (value: boolean) => void; } /** * Hook for managing boolean state with helpful utilities * * Provides toggle, setTrue, and setFalse helpers in addition * to the raw setValue function. * * @param initialValue - Initial boolean value * @returns Object with value and control functions * * @example * ```typescript * function Modal() { * const modal = useToggle(false); * * return ( *
Modal Content
* *