import { useState, useCallback } from "react";


export function useDisclosure(initialState = false) {
    const [opened, setOpened] = useState(initialState);

    return [
        opened,
        useCallback(() => setOpened(true), []),
        useCallback(() => setOpened(false), []),
        useCallback(() => setOpened(prev => !prev), []),
    ] as const;
}
