Blame view

天文台pc/tianwentai-ui/node_modules/react-hook-form/dist/useForm.d.ts 1.29 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
  import { FieldValues, UseFormProps, UseFormReturn } from './types';
  /**
   * Custom hook to manage the entire form.
   *
   * @remarks
   * [API](https://react-hook-form.com/docs/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>}
   *       <button>Submit</button>
   *     </form>
   *   );
   * }
   * ```
   */
  export declare function useForm<TFieldValues extends FieldValues = FieldValues, TContext = any, TTransformedValues = TFieldValues>(props?: UseFormProps<TFieldValues, TContext, TTransformedValues>): UseFormReturn<TFieldValues, TContext, TTransformedValues>;
  //# sourceMappingURL=useForm.d.ts.map