Performant, flexible and extensible forms library for React Hooks
16 Dec 2022 · Newest first
Last checked
Checking sources…
Showing 1 of 1 releases. Full release notes.
Signals highlight changes worth reviewing. They cannot determine whether your application is affected.
⏳ close #9525 add isLoading state for async defaultValues (#9526) 🐞 fix #9581 incorrect type for array of string for message (#9584) 🐞 fix #9571 validation issue with unregister input with valueAsNumber (#9572) 🐞 fix(useWatch): default value for array of inputs (#9555) 📔 fix Controller example using deprecated as prop (#9535) 🐞 fix #9521 isValidting property stuck (#9523) 🔨 feat: Migrate to pnpm (#9516) 🎹 fix #9509 incorrect type for WatchObserver (#9510) 🌳 include flush root render method to createFormControl (#9479)
values propsThe following syntax will react to values prop update/changes.
const values = await fetch('API')
useForm({
values, // will reset the form when values updates
// resetOptions: {
// keepDirtyValues: true
// }
})
defaultValues propsThe following syntax will support async defaultValues, so we will manage the reset form internally and update formState accordingly.
useForm() callresetOptions as wellconst { formState: { isLoading } } = useForm({
defaultValues: fetch('API')
// resetOptions: {
// keepDirtyValues: true
// }
})
React use API
useForm({
defaultValues: use(fetch('API'))
// resetOptions: {
// keepDirtyValues: true
// }
})
values and defaultValuesvalues will react to changes and reflect on the form values, and defaultValues is cached for once and will never re-run the promise or react to defaultValues changes.
⏳ close #9525 add isLoading state for async defaultValues (#9526) 🐞 fix #9581 incorrect type for array of string for message (#9584) 🐞 fix #9571 validation issue with unregister input with valueAsNumber (#9572) 🐞 fix(useWatch): default value for array of inputs (#9555) 📔 fix Controller example using deprecated as prop (#9535) 🐞 fix #9521 isValidting property stuck (#9523) 🔨 feat: Migrate to pnpm (#9516) 🎹 fix #9509 incorrect type for WatchObserver (#9510) 🌳 include flush root render method to createFormControl (#9479)
Huge thanks goes to @nvh95's work on PNPM and also thanks to @bell-steven's contribution