Skip to content

Commit

Permalink
Merge branch 'main' into feat/3960-Add-setter-for-setFieldValue
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Aug 29, 2024
2 parents 0f98bec + 0e617db commit ec3e471
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/api/useField.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ id: useField
title: useField()
---

`useField` is a custom React hook that will automagically help you hook up inputs to Formik. You can and should use it to build your own custom input primitives. There are 2 ways to use it.
`useField` is a React hook used to thread Formik behaviors into arbitrary field components. It provides the greatest amount of flexibility for scenarios where `Field` is inappropriate. There are two ways to use it.

## Example

Expand Down
20 changes: 10 additions & 10 deletions packages/formik/src/FieldArray.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export type FieldArrayConfig = {
} & SharedRenderProps<FieldArrayRenderProps>;
export interface ArrayHelpers<T extends any[] = any[]> {
/** Imperatively add a value to the end of an array */
push<X = T[number]>(obj: X): void;
push<X extends T[number] = T[number]>(obj: X): void;
/** Curried fn to add a value to the end of an array */
handlePush<X = T[number]>(obj: X): () => void;
handlePush<X extends T[number] = T[number]>(obj: X): () => void;
/** Imperatively swap two values in an array */
swap: (indexA: number, indexB: number) => void;
/** Curried fn to swap two values in an array */
Expand All @@ -42,25 +42,25 @@ export interface ArrayHelpers<T extends any[] = any[]> {
/** Imperatively move an element in an array to another index */
handleMove: (from: number, to: number) => () => void;
/** Imperatively insert an element at a given index into the array */
insert<X = T[number]>(index: number, value: X): void;
insert<X extends T[number] = T[number]>(index: number, value: X): void;
/** Curried fn to insert an element at a given index into the array */
handleInsert<X = T[number]>(index: number, value: X): () => void;
handleInsert<X extends T[number] = T[number]>(index: number, value: X): () => void;
/** Imperatively replace a value at an index of an array */
replace<X = T[number]>(index: number, value: X): void;
replace<X extends T[number] = T[number]>(index: number, value: X): void;
/** Curried fn to replace an element at a given index into the array */
handleReplace<X = T[number]>(index: number, value: X): () => void;
handleReplace<X extends T[number] = T[number]>(index: number, value: X): () => void;
/** Imperatively add an element to the beginning of an array and return its length */
unshift<X = T[number]>(value: X): number;
unshift<X extends T[number] = T[number]>(value: X): number;
/** Curried fn to add an element to the beginning of an array */
handleUnshift<X = T[number]>(value: X): () => void;
handleUnshift<X extends T[number] = T[number]>(value: X): () => void;
/** Curried fn to remove an element at an index of an array */
handleRemove: (index: number) => () => void;
/** Curried fn to remove a value from the end of the array */
handlePop: () => () => void;
/** Imperatively remove and element at an index of an array */
remove<X = T[number]>(index: number): X | undefined;
remove<X extends T[number] = T[number]>(index: number): X | undefined;
/** Imperatively remove and return value from the end of the array */
pop<X = T[number]>(): X | undefined;
pop<X extends T[number] = T[number]>(): X | undefined;
}

/**
Expand Down

0 comments on commit ec3e471

Please sign in to comment.