[question] using `useFieldArray` for flat array of strings?
stefanprobst opened this issue · 2 comments
stefanprobst commented
hi, what is the recommended way to use useFieldArray
for a flat array of strings, i.e. not { friends: [{ name: 'one' }, { name: 'two' }] }
but { friends: ['one', 'two'] }
?
from what i understand from the docs, useFieldArray
requires an array of objects with an id
property (which is also what react-hook-form
and i believe do as well), but it is unclear to me how then to use formik
useFieldArray
with flat arrays? thanks!
JoviDeCroock commented
Should just work https://codesandbox.io/s/hooked-form-forked-ix8gb?file=/src/index.js
stefanprobst commented
great, thanks!