-
Notifications
You must be signed in to change notification settings - Fork 0
[Seoin] React Hooks #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: seoin
Are you sure you want to change the base?
Conversation
D5ng
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 useCallback과 useMemo를 많이 사용해보진 않았는데, 기준은 정해놨습니다.
- 데이터 연산 작업이 꽤 복잡하다고 느끼면 useMemo를 사용합니다.
- 컴포넌트가 깊어지는 상황에서 부모 컴포넌트가 리렌더링 된다면 useCallback을 사용하려고 합니다.
우선 사용했을 때와 사용하지 않았을 때를 React dev tools로 비교하는것이 가장 좋은 방법이라고 생각합니다.
저도 특정 수치 이상일 때 메모이제이션을 사용할거다. 라고 정의는 못내렸지만, 시이드 프로젝트에서는 메모이제이션 비용이 더 많이 들지 않나 라는 생각이 드네요.
제가 다른걸 하느라, 제대로 구현을 하지 못했지만 useCallback과 useMemo 부분을 업데이트 할 생각이에요.
| rootComponent: null, | ||
| }; | ||
|
|
||
| function getComponentState(component: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getComponentState 라는 네이밍도 좋고, Map을 사용한 것도 좋아보이네요.
하나 궁금한건 component를 매개변수로 받는데, 이 컴포넌트는 결국 루트 컴포넌트 아닌가요 ????
루트 컴포넌트가 아닌 커스텀 컴포넌트들도 받는건지 궁금합니다
구현 목록
배운 점
고민과 느낀 점