MCPcopy Create free account
hub / github.com/react-hook-form/react-hook-form / move

Function move

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

Source from the content-addressed store, hash-verified

260 };
261
262 const move = (from: number, to: number) => {
263 const updatedFieldArrayValues = control._getFieldArray(name);
264 moveArrayAt(updatedFieldArrayValues, from, to);
265 moveArrayAt(ids.current, from, to);
266 updateValues(updatedFieldArrayValues);
267 setFields(updatedFieldArrayValues);
268 control._setFieldArray(
269 name,
270 updatedFieldArrayValues,
271 moveArrayAt,
272 {
273 argA: from,
274 argB: to,
275 },
276 false,
277 );
278 };
279
280 const update = (
281 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