Type Parameters
- Data extends unknown = undefined
Parameters
- renderItem: ((id: number, item: Data) => ReactElement<any, string | JSXElementConstructor<any>>)
- (id, item): ReactElement<any, string | JSXElementConstructor<any>>
Returns ReactElement<any, string | JSXElementConstructor<any>>
- options: {
initialValue?: Data[];
onChange?: ((items: Data[]) => void);
}Optional
initialValue?: Data[]
Optional
onChange?: ((items: Data[]) => void)
- (items): void
Returns void
Returns {
items: Data[];
onAddItem: ((data: Data) => number);
onRemoveItem: ((id: number) => void);
onUpdateItem: ((id: number, data: Data) => void);
render: (() => Element);
}
An object with the following properties and methods:
- onAddItem: a function that adds a new item to the list.
- onUpdateItem: a function that updates an item in the list.
- onRemoveItem: a function that removes an item from the list.
- items: an array of the current items in the list.
- render: a function that renders the list of items.
items: Data[]
onAddItem: ((data: Data) => number)
- (data): number
Returns number
- The generated ID of the added item.
onRemoveItem: ((id: number) => void)
onUpdateItem: ((id: number, data: Data) => void)
- (id, data): void
Returns void
render: (() => Element)
Creates a list editor that allows adding, updating, and removing items.