npm react-hook-form 7.44.0
Version 7.44.0

latest releases: 7.51.3, 7.51.2, 7.51.1...
11 months ago

📄 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

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

NewReleases is sending notifications on new releases.