MCPcopy
hub / github.com/react-hook-form/react-hook-form / move

Function move

src/useFieldArray.ts:292–312  ·  view source on GitHub ↗
(from: number, to: number)

Source from the content-addressed store, hash-verified

290 };
291
292 const move = (from: number, to: number) => {
293 if (disabled) {
294 return;
295 }
296
297 const updatedFieldArrayValues = control._getFieldArray(name);
298 moveArrayAt(updatedFieldArrayValues, from, to);
299 moveArrayAt(ids.current, from, to);
300 updateValues(updatedFieldArrayValues);
301 setFields(updatedFieldArrayValues);
302 control._setFieldArray(
303 name,
304 updatedFieldArrayValues,
305 moveArrayAt,
306 {
307 argA: from,
308 argB: to,
309 },
310 false,
311 );
312 };
313
314 const update = (
315 index: number,

Callers 12

move.test.tsFile · 0.85
ComponentFunction · 0.85
AppFunction · 0.85
WatchUseFieldArrayFunction · 0.85
NestedArrayFunction · 0.85
UseFieldArrayUnregisterFunction · 0.85
UseFieldArrayFunction · 0.85
NestedArrayFunction · 0.85
NestedArrayFunction · 0.85

Calls

no outgoing calls

Tested by 2

ComponentFunction · 0.68
AppFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…