UNPKG

@pivanov/use-toggle-visibility

Version:

A React hook to toggle visibility of components

4 lines (3 loc) 303 B
import React, { type ComponentType } from 'react'; export type TVisibilityToggle = (e?: React.MouseEvent, openState?: boolean) => void; export declare const useToggleVisibility: <T extends object>(WrappedComponent: ComponentType<T>, initial?: boolean) => [ComponentType<T>, TVisibilityToggle, boolean];