Skip to content

Conversation

@chaaerim
Copy link
Member

@chaaerim chaaerim commented Dec 3, 2025

close: #204

Copy link
Member

@minchodang minchodang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chaaerim
리뷰가 늦었습니다. ㅜㅜ
간단하게 코멘트 남겨 보았습니다.
참고 부탁 드립니다!

## React Hook Form의 성능 {#PerformanceofReactHookForm}

Performance is one of the primary reasons why this library was created. React Hook Form relies on an uncontrolled form, which is the reason why the `register` function captures `ref` and the controlled component has its re-rendering scope with `Controller` or `useController`. This approach reduces the amount of re-rendering that occurs due to a user typing in an input or other form values changing at the root of your form or applications. Components mount to the page faster than controlled components because they have less overhead. As a reference, there is a quick comparison test that you can refer to at [this repo link](https://github.com/bluebill1049/react-hook-form-performance-compare).
성능은 이 라이브러리가 만들어진 주요 이유 중 하나입니다. React Hook Form은 비제어 컴포넌트 방식을 사용하며, 이것이 `register` 함수가 `ref`를 캡처하고 제어 컴포넌트가 `Controller` 또는 `useController`로 자체 리렌더링 범위를 갖는 이유입니다. 이 접근 방식은 사용자가 입력 필드에 타이핑하거나 다른 폼 값이 변경될 때 폼이나 애플리케이션의 루트에서 발생하는 리렌더링의 양을 줄입니다. 컴포넌트는 오버헤드가 적기 때문에 제어 컴포넌트보다 페이지에 더 빠르게 마운트됩니다. 참고로 [이 저장소 링크](https://github.com/bluebill1049/react-hook-form-performance-compare)에서 간단한 성능 비교 테스트를 확인할 수 있습니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컴포넌트는 오버헤드가 적기 때문에 제어 컴포넌트보다 페이지에 더 빠르게 마운트됩니다.
-> 요거 지금 컴포넌트는 이라고만 하니까, 조금 명칭이 불분명하고 이해가 어렵네요. ㅜㅜ

컴포넌트는 -> React Hook Form을 사용한 컴포넌트는 오버헤드가 
적기 때문에 React Hook Form을 사용하지 않은 제어 컴포넌트보다 
페이지에 더 빠르게 마운트됩니다.

---

## How to create an accessible input error and message? {#Howtocreateanaccessibleinputerrorandmessage}
## 접근 가능한 입력 에러 및 메시지를 만드는 방법은? {#Howtocreateanaccessibleinputerrorandmessage}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요건 그냥
접근 가능한 입력 에러 및 메시지 생성 방법?
이라고 간단히 하는 게 더 직관적일 거 같습니다.

---

## Does it work with Class Components? {#DoesitworkwithClassComponents}
## 클래스 컴포넌트에서 작동하나요? {#DoesitworkwithClassComponents}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작동한다는 것보다는,
호환이 더 맞을 거 같아요.

클래스 컴포넌트와 호환되나요?

아니요, 기본적으로는 작동하지 않습니다. 사용하고 싶다면 wrapper를 만들어서 클래스 컴포넌트에서 사용할 수 있습니다.

> You can’t use Hooks inside of a class component, but you can definitely mix classes and function components with Hooks in a single tree. Whether a component is a class or a function that uses Hooks is simply an implementation detail of that component. In the longer term, we expect Hooks to be the primary way people write React components.
> 클래스 컴포넌트 내부에서는 Hook을 사용할 수 없지만, 하나의 트리 안에서 클래스 컴포넌트와 Hook을 사용하는 함수 컴포넌트를 혼합하여 사용할 수는 있습니다. 컴포넌트가 클래스인지 Hook을 사용하는 함수인지는 단순히 해당 컴포넌트의 구현 세부 사항일 뿐입니다. 장기적으로 우리는 Hook이 React 컴포넌트를 작성하는 주요 방법이 될 것으로 기대합니다.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

약간 앞 부분이 어색해 보여서, 읽기 어렵다고 느꼈어요.

클래스 컴포넌트 내부에서는 훅을 사용할 수 없지만, 단일 컴포넌트 트리 내에서 클래스와 함수 컴포넌트를 훅과 함께 혼용하는 것은 가능합니다.

이렇게 다듬어 보는 건 어떨까용?

---

## How to reset the form? {#Howtoresettheform}
## 폼을 어떻게 리셋하나요? {#Howtoresettheform}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how to 류는 물음표(?)가 있다고는 하나,
그냥 방법으로 표기하는 게 어떨까 싶어요.

---

## How to initialize form values? {#Howtoinitializeformvalues}
## 폼 값을 초기화하는 방법은? {#Howtoinitializeformvalues}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기도 통일성을 고려해서,
방법? 하고 끝 맺어도 될 거 같아요.

const { register, handleSubmit } = useForm({
values: data,
resetOptions: {
keepDirtyValues: true, // keep dirty fields unchanged, but update defaultValues
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 주석 부분은 빠진거 같아요 ㅜㅜ

const { ref, ...rest } = register("firstName")
const onClick = () => {
firstNameRef.current!.value = ""
firstNameRef.current.value = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요기 타입 Non-null Assertion Operator는 일부러 빼신 걸까용?

---

## How to work with modal or tab forms? {#Howtoworkwithmodalortabforms}
## 모달 또는 탭 폼과 함께 작업할 때는 어떻게 해야 하나요? {#Howtoworkwithmodalortabforms}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요것도 how to라서
그냥

모달 또는 탭 폼 작업 방법 

정도로 가볍게 마무리하는 게 통일성 있을 거 같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Docs] content/faqs.mdx — Sync

3 participants