ð Improved async defaultValues
inference
const fetchData = async () => {
await sleep(1000)
return {
data: 'test'
}
}
- useForm<Awaited<ReturnTypeof<typeof fetchData>>>({
+ useForm({
defaultValues: fetchData, // will infer the promise return type
})
ð Improved useForm
resetOptions to keep track of dirty input
- const { formState: { dirtyFields } } = useForm({
+ useForm({ // dirtyFields subscription is no longer required
values,
resetOptions: {
keepDirtyValues; true, // only non dirty input will receive data from the values update
}
})
ðŠķ improve useFormContext
perf by avoiding reference re-create with omit
ðĶ close #9410 improve UX when subscribing to both isValid and errors
state (#9413)