Skip to content

Handling Nested dynamic fields - one place for all duplicate issues like this, hopefully 😅 #2476

Discussion options

You must be logged in to vote

Hey! So this is a great question. There is no silver bullet here.

If you find it easier to use field-level validation, then do it. It can be nice to colocate validation where you make the decision about what to render. It’s really useful when fields are added / removed like the situation you described, but also rely on some kind interim state or side effect that is not accessible to Formik’s validate or validationSchema’s function scopes.

Another approach is to write a function that returns a validation function or validation schema. This works well when you can derive/predict all validation from just the values and state/props above your form (and guarantee that no keys are going to be a…

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
6 replies
@leup
Comment options

@ypahalajani
Comment options

@leup
Comment options

@ypahalajani
Comment options

@leup
Comment options

Comment options

You must be logged in to vote
1 reply
@ypahalajani
Comment options

Answer selected by ypahalajani
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants