TanStackT
TanStack12mo ago
7 replies
worthy-rose

Any advantage to setting defaultValues instead of setFieldValue?

We are loading a bunch of values from an API on mount and setting them through setFieldValue.

I see that we can also set them through the useForm defaultValues and I was hoping that doing this would keep the fields isTouched to false. However both approaches seem to result in the fields being isTouched:true so I'm leaning towards just keeping the setFieldValue.

Are there any advantages to using defaultValues instead of just setFieldValue on load? Why would I do either?
Was this page helpful?