@supunlakmal/hooks
Version:
A collection of reusable React hooks
23 lines (22 loc) • 704 B
TypeScript
/**
* Type definition for the return value of useToggle.
* It includes the current boolean state and functions to manipulate it.
*/
type UseToggleReturn = [
boolean,
() => void,
() => void,
() => void
];
/**
* A simple hook to manage boolean state with a toggle function.
*
* @param initialValue - The initial boolean state (defaults to false).
* @returns An array containing:
* - The current boolean value.
* - A function to toggle the value.
* - A function to explicitly set the value to true.
* - A function to explicitly set the value to false.
*/
export declare const useToggle: (initialValue?: boolean) => UseToggleReturn;
export {};