이게 뭔가요?

주요 기능

사용법

useForm

form 데이터를 관리하는 하나의 객체

const SomeComponent = () => {	
	const {
	  handleSubmit,
	  control,
	  formState: { errors },
	  getValues,
	} = useForm<IJoin>();
	
	return (<>...</>)
}
export interface IJoin {
  phoneNumber: string;
  email: string;
  passwordRepeat: string;
  passWord: string;
  nickName: string;
  verification: string;
}

기타 자세한 메서드는 API Doc 참조

https://react-hook-form.com/api/useform

Controller

<Controller
  control={control}
  render={({ field: { onChange, onBlur, value } }) => (
    <Input
      type={type}
      onBlur={onBlur}
      value={value}
      onChange={onChange}
      placeholder={placeholder}
      error={errors[name]?.message}
    />
  )}
  name={name}
  rules={rules}
/>