MCPcopy Index your code
hub / github.com/react-hook-form/react-hook-form / remove

Function remove

src/useFieldArray.ts:225–241  ·  view source on GitHub ↗
(index?: number | number[])

Source from the content-addressed store, hash-verified

223 };
224
225 const remove = (index?: number | number[]) => {
226 if (disabled) {
227 return;
228 }
229
230 const updatedFieldArrayValues: Partial<
231 FieldArrayWithId<TFieldValues, TFieldArrayName, TKeyName>
232 >[] = removeArrayAt(control._getFieldArray(name), index);
233 ids.current = removeArrayAt(ids.current, index);
234 updateValues(updatedFieldArrayValues);
235 setFields(updatedFieldArrayValues);
236 !Array.isArray(get(control._fields, name)) &&
237 set(control._fields, name, undefined);
238 control._setFieldArray(name, updatedFieldArrayValues, removeArrayAt, {
239 argA: index,
240 });
241 };
242
243 const insert = (
244 index: number,

Callers 15

ItemFunction · 0.85
AppFunction · 0.85
ComponentFunction · 0.85
ComponentFunction · 0.85
ComponentFunction · 0.85
AppFunction · 0.85
ArrayFieldFunction · 0.85
FieldArrayFunction · 0.85
remove.test.tsFile · 0.85
ComponentFunction · 0.85
NestedFunction · 0.85
AppFunction · 0.85

Calls

no outgoing calls

Tested by 13

ItemFunction · 0.68
AppFunction · 0.68
ComponentFunction · 0.68
ComponentFunction · 0.68
ComponentFunction · 0.68
AppFunction · 0.68
ArrayFieldFunction · 0.68
FieldArrayFunction · 0.68
ComponentFunction · 0.68
NestedFunction · 0.68
AppFunction · 0.68
ComponentFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…