shadcn-ahooks

useDynamicList

A hook that helps you manage dynamic list and generate unique key for each item.

Overview

A hook that helps you manage dynamic list and generate unique key for each item.

Documentation and Examples

Installation

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

A hook that helps you manage dynamic list and generate unique key for each item.

Examples

Basic usage

Using with antd Form

Another way of writing used in antd Form

Draggable dynamic table

API

const result: Result = useDynamicList(initialValue: T[]);

Result

| Property | Description | Type | Remarks | | - | -- | - | | initialValue | Initial value of the list | T[] | [] |

On this page