UNPKG

@procore/core-react

Version:
28 lines (27 loc) 659 B
export interface SetHookConfig<T> { /** * @since 10.19.0 */ initialValue?: Set<T>; /** * @since 10.19.0 */ onChange?: (newCollection: Set<T>) => void; /** * @since 10.19.0 */ onAdd?: (item: T) => void; /** * @since 10.19.0 */ onRemove?: (item: T) => void; } export declare function useSet<T>({ initialValue, onChange, onAdd, onRemove, }?: SetHookConfig<T>): { collection: Set<T>; setCollection: (newCollection: Set<T>) => void; has: (item: T) => boolean; add: (item: T) => void; remove: (item: T) => void; removeAll: () => void; toggle: (item: T) => void; };