npm react-hook-form 7.37.0
Version 7.37.0

latest releases: 7.53.1, 7.53.0, 7.52.2...
2 years ago

🍨 feature: include defaultValues inside formState (#8966)

const { formState, watch } = useForm({
  defaultValues: { name: 'test' }
})
const { defaultValues } = useFormState()

const name = watch('name')

return (
  <div>
    <p>Your name was {defaultValues.name}</p>
    <p>Updated name is {name}</p>
  </div>
)
Screen.Recording.2022-10-07.at.8.55.56.am.mov

🖨 close #9058 avoid clone object when contains prototype methods

class DataModel {
  constructor() {
    this.firstName = null
  }
}
const formData = new DataModel({ firstName: "Bob" })

useForm({
  defaultValues: formData // no longer get clone internally
})

🐞 fix #9134 useFieldArray validation action inconsistency (#9136)
🥷 close #9126 useController ref overwrite under strict mode (#9130)
😵‍💫 close #9105 improve input focus method check (#9109)
📖 fix UseFieldArrayAppend types example (#9093)
🖇 change link (#9159)
🙌 improve naming of options forEach local (#9152)

thanks to @arieloO @Ilaygoldman and @simenbrekken-visma

Don't miss a new react-hook-form release

NewReleases is sending notifications on new releases.