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.
 
 
 

27 lines
1.2 KiB

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/api/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>>(props: UseControllerProps<TFieldValues, TName>): UseControllerReturn<TFieldValues, TName>;
//# sourceMappingURL=useController.d.ts.map