UNPKG

@leancodepl/utils

Version:

Common utility functions and React hooks for web applications

24 lines (23 loc) 728 B
import { Dispatch, SetStateAction } from "react"; /** * React hook for boolean state management helpers. * * @param set - The state setter function from useState * @returns A tuple containing [setTrue: function, setFalse: function] * @example * ```typescript * function MyComponent() { * const [isVisible, setIsVisible] = useState(false); * const [show, hide] = useSetUnset(setIsVisible); * * return ( * <div> * <button onClick={show}>Show</button> * <button onClick={hide}>Hide</button> * {isVisible && <div>Content is visible</div>} * </div> * ); * } * ``` */ export declare function useSetUnset(set: Dispatch<SetStateAction<boolean>>): readonly [() => void, () => void];