Conversation
chxxwn04
reviewed
Dec 21, 2025
| - deps 배열에 필요한 state나 props를 빠뜨리면, **최신 값이 아닌 과거 값**을 계속 사용하게 된다. | ||
| - 이를 피하려면 **콜백에서 사용하는 모든 값들을 deps에 정확히 포함**해야 한다. | ||
| - 상태 업데이트가 목적이라면 `setState(prev => …)` 같은 **함수형 업데이트**를 사용하면 stale closure를 안전하게 피할 수 있다. | ||
| - **`useCallabck`**을 사용한 콜백 메모이제이션 예시 🍠 |
There was a problem hiding this comment.
memo로 감싼 자식 컴포넌트가 있음에도 불구하고,
콜백을 메모이제이션하지 않으면 리렌더링이 발생한다는 점을 예시로 보여준 것이 이해에 큰 도움이 되었습니당
wooojin401
reviewed
Dec 21, 2025
| **2) React 성능 최적화(Optimization) Hooks 마스터** | ||
|
|
||
| - `useCallback`, `useMemo`, `React.memo`의 개념과 차이점을 명확히 구분할 수 있다. | ||
| - 메모이제이션(Memoization)이 무엇인지 이해하고, 불필요한 리렌더링을 방지하는 코드를 직접 구현할 수 있다. |
sunnyinha
reviewed
Dec 22, 2025
| - 콜백 내부에서 사용하는 **state, props, 변수는 모두 deps에 포함**해야 한다. | ||
| - deps는 **항상 고정된 길이의 배열**이어야 한다. | ||
| - React는 deps를 `Object.is`로 비교한다. | ||
| - 의존성 변경 시 콜백이 어떻게 다시 만들어지는지 |
Collaborator
There was a problem hiding this comment.
usecallback 특징을 잘 정리하셨네요!
Collaborator
|
조이 마지막까지 열심히 노력해주셔서 감사하고 데모데이까지 파이팅입니다! |
sunnyinha
approved these changes
Dec 22, 2025
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.
✅ 워크북 체크리스트
✅ 컨벤션 체크리스트
📌 주안점