Blame view

天文台pc/tianwentai-ui/node_modules/react-hook-form/dist/useController.d.ts 1.21 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
  import { FieldPath, FieldValues, UseControllerProps, UseControllerReturn } from './types';
  /**
   * Custom hook to work with controlled component, this function provide you with both form and field level state. Re-render is isolated at the hook level.
   *
   * @remarks
   * [API](https://react-hook-form.com/docs/usecontroller) • [Demo](https://codesandbox.io/s/usecontroller-0o8px)
   *
   * @param props - the path name to the form field value, and validation rules.
   *
   * @returns field properties, field and form state. {@link UseControllerReturn}
   *
   * @example
   * ```tsx
   * function Input(props) {
   *   const { field, fieldState, formState } = useController(props);
   *   return (
   *     <div>
   *       <input {...field} placeholder={props.name} />
   *       <p>{fieldState.isTouched && "Touched"}</p>
   *       <p>{formState.isSubmitted ? "submitted" : ""}</p>
   *     </div>
   *   );
   * }
   * ```
   */
  export declare function useController<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>, TTransformedValues = TFieldValues>(props: UseControllerProps<TFieldValues, TName, TTransformedValues>): UseControllerReturn<TFieldValues, TName>;
  //# sourceMappingURL=useController.d.ts.map