Conversation
D5ng
reviewed
Feb 3, 2025
Member
D5ng
left a comment
There was a problem hiding this comment.
저도 useCallback과 useMemo를 많이 사용해보진 않았는데, 기준은 정해놨습니다.
- 데이터 연산 작업이 꽤 복잡하다고 느끼면 useMemo를 사용합니다.
- 컴포넌트가 깊어지는 상황에서 부모 컴포넌트가 리렌더링 된다면 useCallback을 사용하려고 합니다.
우선 사용했을 때와 사용하지 않았을 때를 React dev tools로 비교하는것이 가장 좋은 방법이라고 생각합니다.
저도 특정 수치 이상일 때 메모이제이션을 사용할거다. 라고 정의는 못내렸지만, 시이드 프로젝트에서는 메모이제이션 비용이 더 많이 들지 않나 라는 생각이 드네요.
제가 다른걸 하느라, 제대로 구현을 하지 못했지만 useCallback과 useMemo 부분을 업데이트 할 생각이에요.
| rootComponent: null, | ||
| }; | ||
|
|
||
| function getComponentState(component: any) { |
Member
There was a problem hiding this comment.
getComponentState 라는 네이밍도 좋고, Map을 사용한 것도 좋아보이네요.
하나 궁금한건 component를 매개변수로 받는데, 이 컴포넌트는 결국 루트 컴포넌트 아닌가요 ????
루트 컴포넌트가 아닌 커스텀 컴포넌트들도 받는건지 궁금합니다
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
구현 목록
배운 점
고민과 느낀 점