Skip to content

Is it possible to revalidate a form after setting the defaults? #99

Answered by airjp73
swelham asked this question in Q&A
Discussion options

You must be logged in to vote

Adding a form-wide validate or clearErrors is a feature that's on my radar. Hopefully I'll have time to add it soon. It might even be worth adding an reinitialize option similar to what formik has.

For now, for this use-case you could pass a formRef to the validated form and call formRef.current.reset() after the new default values have been populated. Or adding a key prop to the form that changes when the default values change would also work.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@swelham
Comment options

@airjp73
Comment options

@fergusmeiklejohn
Comment options

@airjp73
Comment options

Answer selected by swelham
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