synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
15 lines • 666 B
TypeScript
export interface UseSetReturn<T> {
set: Omit<Set<T>, 'add' | 'delete' | 'clear'>;
add: (...items: T[]) => void;
remove: (item: T) => void;
clear: () => void;
}
/**
* Hook for storing an ES6 set in React state. Methods that mutate the set have been hidden via TypeScript,
* so if you adhere to the type definitions, the set is essentially immutable.
* Modifications to the set should only be done via the functions returned by the hook, which will create a new object to trigger rerendering.
* @param initialState
* @returns
*/
export declare function useSet<T>(initialState?: T[] | Set<T>): UseSetReturn<T>;
//# sourceMappingURL=useSet.d.ts.map