UNPKG

synapse-react-client

Version:

[![Build Status](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client.svg?branch=main)](https://travis-ci.com/Sage-Bionetworks/Synapse-React-Client) [![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synaps

15 lines (14 loc) 630 B
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>;