useFieldArray only works with deconstruct #3768
Answered
by
logaretm
expliArturSmolen
asked this question in
Q&A
-
Good day to all, can someone explain me why Template:
Working:
Not working:
Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Answered by
logaretm
May 13, 2022
Replies: 1 comment
-
This is a <!-- fields is a ref, so you need to unwrap it -->
<div v-for="(field, idx) in fieldArray.fields.value" > or You can also wrap import { useFieldArray } from "vee-validate";
import { reactive } from 'vue';
const fieldArray = reactive(useFieldArray('users')); I will add a quick note to the docs about this. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
expliArturSmolen
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a
setup
caveat, not a vee-validate issue. Becausesetup
doesn't unwrap refs recursively, so you either need to do that yourself like:or You can also wrap
useFieldArray
withreactive
which is mentioned by Vue docs. Note that you cannot destruct it if you use this approach.I will add a quick note to the docs about this.