[8팀 현지수] Chapter 4-2 코드 관점의 성능 최적화 #40
Open
hyunzsu wants to merge 47 commits into
Open
Conversation
- DraggableSchedule: 드래그 가능한 강의 스케줄 컴포넌트 - ScheduleDndProvider: 드래그 앤 드롭 컨텍스트 제공자 - ScheduleTables: 시간표 목록 관리 컴포넌트 - ScheduleTable: 개별 시간표 컴포넌트 - ScheduleTableGrid: 시간표 그리드 컴포넌트 - index.ts: 배럴 익스포트 파일"
- ScheduleTable과 ScheduleDndProvider를 래핑한 컨테이너 - useScheduleTable 훅으로 특정 테이블 데이터 조회 - actions.deleteSchedule로 스케줄 삭제 처리
- useScheduleDrag: 특정 테이블의 드래그 상태 확인 (성능 최적화) - useActiveDragTableId: 현재 드래그 중인 테이블 ID 반환 - useDndContext 사용을 중앙화하여 불필요한 구독 방지
- MOVE_SCHEDULE 액션 타입 정의 및 처리 로직 구현 - 상대적 위치 이동 계산 (moveDayIndex, moveTimeIndex)
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://hyunzsu.github.io/front_6th_chapter4-2/
과제 요구사항
배포 후 url 제출
API 호출 최적화(
Promise.all이해)SearchDialog 불필요한 연산 최적화
SearchDialog 불필요한 리렌더링 최적화
시간표 블록 드래그시 렌더링 최적화
시간표 블록 드롭시 렌더링 최적화
기술적 성장
1. 클로저 활용한 캐싱 시스템 구현
Before
After
학습 포인트
2. React 메모이제이션
폴더 구조
SearchItem 컴포넌트 - arePropsEqual 함수를 활용한 렌더링 제어
왜 arePropsEqual 함수가 필요했는가?
기본 React.memo vs arePropsEqual 함수 비교
세부 컴포넌트 메모이제이션
학습 포인트
3. 커스텀 훅을 통한 로직 추상화
useAutoCallback 훅 - 콜백 안정화 패턴
활용 예시
useScheduleDrag 훅 - DnD 상태 최적화
개선점
4. useMemo 체이닝을 통한 필터링 최적화
Before
After
학습 포인트
코드 품질
1. useReducer 패턴을 통한 상태관리 구조화
기존 문제점
기존 useState로 관리되던 복잡한 시간표 상태는 다음과 같은 문제점들이 있었습니다:
Before - 분산된 상태 관리
After - useReducer 패턴 적용
코드 품질 개선 효과
2. DnD 시스템 최적화 - 드롭 시 렌더링 문제 해결
기존 문제점
드래그 앤 드롭 발생 시 Context 의존성으로 인해 모든 테이블 컴포넌트가 불필요하게 리렌더링되어 사용자 체감 성능이 저하되었습니다.
Before - Context 직접 구독
After - Props를 통한 독립적 렌더링
개별 테이블 관리 컴포넌트 분리
코드 품질 개선 효과
학습 효과 분석
가장 큰 배움이 있었던 부분
React 성능 최적화의 체계적 접근법을 학습할 수 있었습니다. 단순히 memo나 useMemo를 사용하는 것을 넘어서, 문제의 근본 원인을 파악하고 구조적으로 해결하는 방법을 익혔습니다. 특히 클로저 기반 캐싱, useMemo 체이닝, areEqual 함수를 활용한 정밀한 렌더링 제어 등 실무에서 바로 적용 가능한 기법들을 습득했습니다.
리뷰 받고 싶은 내용
과도한 메모이제이션이 오히려 메모리 사용량 증가나 코드 복잡성을 높일 수 있다고 하는데, 실제 프로덕션 환경에서는 어떤 기준으로 메모이제이션 적용 여부를 판단하시는지, 그리고 성능 측정과 최적화의 우선순위를 어떻게 정하시는지 경험을 공유해주실 수 있을까요?