goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
19 lines • 818 B
TypeScript
export interface FieldArrayBinding<T> {
/** The current array (empty when unset / not an array). */
items: T[];
/** Append an item to the end. */
append: (item: T) => void;
/** Remove the item at `index`. */
remove: (index: number) => void;
/** Replace the item at `index`. */
update: (index: number, item: T) => void;
/** Move an item from one index to another (reorder). No-op on out-of-range. */
move: (from: number, to: number) => void;
/**
* The dotted field-name prefix for item `index` (e.g. `"features.0"`). Compose
* a child field's `name` as `` `${itemName(i)}.<key>` ``.
*/
itemName: (index: number) => string;
}
export declare function useFieldArray<T = unknown>(name: string): FieldArrayBinding<T>;
//# sourceMappingURL=useFieldArray.d.ts.map