Replies: 3 comments
-
|
react-hook-form을 사용할 떄와 사용하지 않을 때의 코드 수를 비교해보았다. const setSexValue = (value: string) => {
setInputValue((prev) => ({
...prev,
sex: value,
}));
}; const setSexValue = (value: string) => {
setValue('sex', value);
};단순히 값을 설정하는 함수인데도 이렇게 명확한 차이가 보인다. useState로 각 input을 관리할 경우, 코드가 길어지고, 이는 유지보수성 측면에서 상당히 좋지 않다. 코드는 더욱 길어지고, 코드를 읽기 어려워지게 된다. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
react-hook-form 위처럼 코드 가독성과 유지보수성을 좋게 해줄 뿐 아니라 다양한 장점이 있다.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
|
이렇게 좋은 라이브러리를 안쓸 이유가 없다고 생각하여, 사용하는 것으로 결론을 내린다 👏👏 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
-
현재, 회원가입의 페이지에서는 React-Hook-Form라이브러리를 이용하여 간편하게 input값을 관리하고 있습니다.
이 input값 관리를 꼭 React-Hook-Form 라이브러리를 이용하여야 하는지 의문이 들어 제기해보았습니다.
매 번 onChange 함수와 type설정을 줄이기 위해 useInput 훅을 만들어보았습니다.
초기값을 인자로 넘겨주면 value, onChange, setValue 값을 반환합니다.
Beta Was this translation helpful? Give feedback.
All reactions