📄 New <Form /> Component (https://github.com/react-hook-form/react-hook-form/pull/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 (https://github.com/react-hook-form/react-hook-form/pull/10322)
useFormContext<FormValue, TransformedValues>()
🚔 added TTransformedValues to FormProvider (https://github.com/react-hook-form/react-hook-form/pull/10368)
FormProviderProps<TFieldValues, TContext, TTransformedValues>
🐞 fix https://github.com/react-hook-form/react-hook-form/issues/10139 with errors diff from the previous with field array action (https://github.com/react-hook-form/react-hook-form/pull/10216) 🐞 related https://github.com/react-hook-form/react-hook-form/issues/10238 return default values in watch and useWatch when reset is called with an empty object 🦮 remove unnecessary as unknown as cast (https://github.com/react-hook-form/react-hook-form/pull/10300) 🧛♂️ close https://github.com/react-hook-form/react-hook-form/issues/10277 remove pattern empty string check (https://github.com/react-hook-form/react-hook-form/pull/10279) 🐞 fix bugs that occur in the presence of Array polyfills () 🫥 close stop shouldUseNativeValidation pass down constraint props () 😵💫 close re-register controller input to fix strict mode () ✍️ update form.tsx for TSdoc ()