How to transform query results before passing them to `useForm`?
My api returns a JSON string in one of its endpoints. Something like this
I use this field with react-hook-form's
useFieldArray
to show an array of input fields to edit each list item.
but because list
is a string and not an array it doesn't work. What's the best way to convert list
to JSON before useForm
hook use it? I'm trying to avoid updating my data providers as much as possible because they are already messy. Is there any way to achieve this without updating data providers?3 Replies
Hey @amirhhashemi 👋,
You can use queryOptions.select property of useForm hook⚡️
fair-roseOP•3y ago
Oh that's neat. Thank you so much
For anyone else who has the same problem, you should do this: