Skip to content

How Can I Pass Individual Array Item Using AppField and useFieldContext? #1322

Answered by juanvilladev
ShoeBoom asked this question in Q&A
Discussion options

You must be logged in to vote

This issue has been raised before in the discord but haven't really received any input on if array elements will ever be treated as fields themselves. Methods within the source code such as form.validate, form.getFieldValue actually work at runtime when doing:

form.getFieldValue(`Array${i}` as DeepKeys<TFormData>) // type casting gets rid of the typescript error.

Example:

this.validateField(`${field}[${index1}]` as DeepKeys<TFormData>, 'change')
this.validateField(`${field}[${index2}]` as DeepKeys<TFormData>, 'change')

I would highly suggest not doing this within your code since this is likely not …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ShoeBoom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants