Skip to content

Please provide an example of how to use initialValues in vee-validate@4.12 since they are not reactive now #4576

Answered by logaretm
osipMax asked this question in Q&A
Discussion options

You must be logged in to vote

You need to call resetForm whenever you need the initial values to be set. Assuming you have a MyForm component and your initial values are async then you can setup a watcher.

const { values, resetForm } = useForm();

watch(() => props.initialData, (newData) => {
  if (isEqual(newData, values)) {
    return;
  }

  resetForm({ values: newData });
})

Replies: 1 comment

Comment options

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