UNPKG

@supunlakmal/hooks

Version:

A collection of reusable React hooks

19 lines (18 loc) 624 B
interface SetActions<T> { add: (value: T) => void; remove: (value: T) => void; toggle: (value: T) => void; reset: () => void; clear: () => void; has: (value: T) => boolean; } type UseSetResult<T> = [Set<T>, SetActions<T>]; /** * Custom hook to manage state as a Set, providing helper functions. * * @template T - The type of the values in the Set. * @param initialSet - Optional initial Set or an iterable of values. * @returns A tuple containing the current Set state and an actions object. */ export declare const useSet: <T>(initialSet?: Set<T> | Iterable<T>) => UseSetResult<T>; export {};