[2팀 학메 진채영]Chapter 1-3. React, Beyond the Basics#53
Open
devchaeyoung wants to merge 16 commits intohanghae-plus:mainfrom
Open
[2팀 학메 진채영]Chapter 1-3. React, Beyond the Basics#53devchaeyoung wants to merge 16 commits intohanghae-plus:mainfrom
devchaeyoung wants to merge 16 commits intohanghae-plus:mainfrom
Conversation
shallowEquals에 baseEquals 로직 활용
- baseEuals에 typeGuard 적용
- 순수함수로 로직분리
- useMemo(() => fn, deps)활용 - 함수 자체를 메모이제이션함
훅 역할 - 객체 상태에서 실제 값이 변경되지 않았을 때 리렌더링 방지 - 폼 상태 관리에서 성능 최적화 - 복잡한 객체의 얕은 속성만 관리할 때 사용
역할 - 항상 동일한 함수 참조를 반환
Member
|
wow |
bebusl
reviewed
Jul 24, 2025
|
|
||
| type ComparisonCallback = (a: unknown, b: unknown) => boolean; | ||
|
|
||
| export const baseEquals = (a: unknown, b: unknown, compareValues: ComparisonCallback): boolean => { |
nemobim
reviewed
Jul 24, 2025
Comment on lines
+41
to
+47
| export const isSameType = (a: unknown, b: unknown): boolean => { | ||
| if (isNullish(a) && isNullish(b)) return true; | ||
| if (isPrimitive(a) && isPrimitive(b)) return typeof a === typeof b; | ||
| if (isArray(a) && isArray(b)) return true; | ||
| if (isObject(a) && isObject(b)) return true; | ||
| return false; | ||
| }; |
There was a problem hiding this comment.
오 이렇게 다 뽑아서 비교하는 로직 엄청 깔끔하고 좋네요!!
다만 isNullish 는 packages/lib/src/equals/baseEquals.ts 에서 2번해서 검사해주니까 여긴 빼도 좋을거같습니다!!
- 언마운트시 리스너 제거를 위한 unsubscribe 추가
- 불필요한 타입 수정
|
과제 하는 학메 최고 |
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.

과제 체크포인트
배포 링크
https://devchaeyoung.github.io/front_6th_chapter1-3/
기본과제
equalities
hooks
High Order Components
심화 과제
hooks
context
과제 셀프회고
기술적 성장
자랑하고 싶은 코드
개선이 필요하다고 생각하는 코드
학습 효과 분석
과제 피드백
학습 갈무리
리액트의 렌더링이 어떻게 이루어지는지 정리해주세요.
메모이제이션에 대한 나의 생각을 적어주세요.
컨텍스트와 상태관리에 대한 나의 생각을 적어주세요.
리뷰 받고 싶은 내용