shadcn-ahooks

useSet

A hook that can manage the state of Set.

Overview

A hook that can manage the state of Set.

Documentation and Examples

Installation

Open in
pnpm dlx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useSet.json
npx shadcn@latest add https://shadcn-ahooks.vercel.app/r/useSet.json
yarn shadcn@latest add https://shadcn-ahooks.vercel.app/r/useSet.json
bun shadcn@latest add https://shadcn-ahooks.vercel.app/r/useSet.json

A hook that can manage the state of Set.

Examples

Default usage

API

const [
  set,
  {
    add,
    remove,
    reset
  }
] = useSet<K>(initialValue);

Result

| Property | Description | Type | | -- | | - | - | | initialValue | Optional, set default value | Iterable<K> | - |

On this page