You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.3 KiB
32 lines
1.3 KiB
2 years ago
|
import { FieldValues, UseFormProps, UseFormReturn } from './types';
|
||
|
/**
|
||
|
* Custom hook to mange the entire form.
|
||
|
*
|
||
|
* @remarks
|
||
|
* [API](https://react-hook-form.com/api/useform) • [Demo](https://codesandbox.io/s/react-hook-form-get-started-ts-5ksmm) • [Video](https://www.youtube.com/watch?v=RkXv4AXXC_4)
|
||
|
*
|
||
|
* @param props - form configuration and validation parameters.
|
||
|
*
|
||
|
* @returns methods - individual functions to manage the form state. {@link UseFormReturn}
|
||
|
*
|
||
|
* @example
|
||
|
* ```tsx
|
||
|
* function App() {
|
||
|
* const { register, handleSubmit, watch, formState: { errors } } = useForm();
|
||
|
* const onSubmit = data => console.log(data);
|
||
|
*
|
||
|
* console.log(watch("example"));
|
||
|
*
|
||
|
* return (
|
||
|
* <form onSubmit={handleSubmit(onSubmit)}>
|
||
|
* <input defaultValue="test" {...register("example")} />
|
||
|
* <input {...register("exampleRequired", { required: true })} />
|
||
|
* {errors.exampleRequired && <span>This field is required</span>}
|
||
|
* <input type="submit" />
|
||
|
* </form>
|
||
|
* );
|
||
|
* }
|
||
|
* ```
|
||
|
*/
|
||
|
export declare function useForm<TFieldValues extends FieldValues = FieldValues, TContext extends object = object>(props?: UseFormProps<TFieldValues, TContext>): UseFormReturn<TFieldValues, TContext>;
|
||
|
//# sourceMappingURL=useForm.d.ts.map
|