Releases: react-hook-form/react-hook-form
Version 7.44.1
🐞 fix <Form />
component content-type json type missing (#10454)
Version 7.44.0
📄 New <Form />
Component (#9735)
https://react-hook-form.com/docs/useform/form
- add try and catch for JSON.stringify
// Send post request with formData
<Form
action="/api"
control={control}
onSuccess={() => {
alert("Great");
}}
/>
// Send post request with json form data
<Form action="/api" encType="application/json" headers={{ accessToken: 'test' }}>
{errors.root?.server.type === 500 && 'Error message'}
{errors.root?.server.type === 400 && 'Error message'}
</Form>
// Send post request with formData with fetch
<Form
onSubmit={async ({ formData, data, formDataJson, event }) => {
await fetch("api", {
method: "post",
body: formData,
});
}}
/>
🗝️ support TransformedValues with useFormContext (#10322)
useFormContext<FormValue, TransformedValues>()
🚔 added TTransformedValues to FormProvider (#10368)
FormProviderProps<TFieldValues, TContext, TTransformedValues>
🐞 fix #10139 with errors diff from the previous with field array action (#10216)
🐞 related #10238 return default values in watch and useWatch when reset is called with an empty object
🦮 remove unnecessary as unknown as cast (#10300)
🧛♂️ close #10277 remove pattern empty string check (#10279)
🐞 fix #9037 bugs that occur in the presence of Array polyfills (#10328)
🫥 close #10348 stop shouldUseNativeValidation pass down constraint props (#10350)
😵💫 close #10386 re-register controller input to fix strict mode (#10418)
✍️ update form.tsx for TSdoc (#10399)
thanks to @yasamoka & @Torvin @ryota-murakami & @devakrishna33
Version 7.44.0-rc.4
👔 Improve Form component onSubmit
and remove fetcher
prop (#10425)
<Form
- fetcher={(...) => {}}
+ onSubmit={await ({ formData, data, event }) => {
+ await fetch('/api', { body: formData, method: 'post' })
+ }}
/>
// With action prop, it achieve the same as above
<Form action="/api" />
😵💫 close #10386 re-register controller input to fix strict mode (#10418)
✍️ update form.tsx for TSdoc (#10399)
Version 7.44.0-rc.3
Version 7.44.0-rc.2
🗝️ support TransformedValues with useFormContext (#10322)
useFormContext<FormValue, TransformedValues>()
🦮 remove unnecessary as unknown as cast (#10300)
🧛♂️ close #10277 remove pattern empty string check (#10279)
thanks to @ryota-murakami
Version 7.44.0-rc.1
📄 Form Component (#9735)
- add try and catch for JSON.stringify
🐞 fix #10139 with errors diff from the previous with field array action (#10216)
🐞 related #10238 return default values in watch and useWatch
when reset is called with an empty object
thanks to @devakrishna33
Version 7.43.9
Version 7.43.8
🪡 related #10143 did not update dirty until interacted (#10157)
🐞 fix #10139 useFieldArray array error not updating in some cases (#10150)
thanks to @kylemclean
Version 7.43.7
Version 7.43.6
🐞 fix(appendErrors): incorrect type, it can take an array of errors (#10125)
✍️ close #10096 react strict mode with mounted field value (#10102)
🦮 fix: isLoading form state (#10095)
📝 fix: typos in tsdoc (#10088)
🩴 close #10078 prevent stabled aysnc validation (#10082)
🐞 fix #10064 native validation when subscribe to isValid (#10072)
📝 correct typo in field array type declaration (#10066)
thanks to @jorisre @chrisbarless @mjw-isp and @adamtowle