Skip to content
On this page

useSet

A hook that can manage the state of Set.

Code demonstration

API

const [
  set,
  {
    add,
    remove,
    reset,
    has,
    clear
  }
] = useSet(initialValue?: Iterable<K>);
const [
  set,
  {
    add,
    remove,
    reset,
    has,
    clear
  }
] = useSet(initialValue?: Iterable<K>);

Result

PropertyDescriptionType
setSet objectReadonly<Ref<Set>>
addAdd item(key: T) => void
removeRemove item(key: T) => void
clearClear Set() => void
hasSet has(key: T) => void
resetReset to default() => void

Params

PropertyDescriptionTypeDefault
initialValueOptional, set default valueIterable<K>-

Source

SourceDocsDemo