[7팀 이현지] Chapter 2-2. 나만의 React 만들기 #45
Open
Leehyunji0715 wants to merge 26 commits intohanghae-plus:mainfrom
Open
[7팀 이현지] Chapter 2-2. 나만의 React 만들기 #45Leehyunji0715 wants to merge 26 commits intohanghae-plus:mainfrom
Leehyunji0715 wants to merge 26 commits intohanghae-plus:mainfrom
Conversation
…ment createTextElement'
매우 인정합니다,, 저는 리액트 직접 구현해보면서, 이게 JavaScript 기능이었다고? 싶은 모먼트가 되게 많았던 것 같아요. |
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://leehyunji0715.github.io/front_7th_chapter2-2/
기본과제
Phase 1: VNode와 기초 유틸리티
core/elements.ts:createElement,normalizeNode,createChildPathutils/validators.ts:isEmptyValueutils/equals.ts:shallowEquals,deepEqualsPhase 2: 컨텍스트와 루트 초기화
core/types.ts: VNode/Instance/Context 타입 선언core/context.ts: 루트/훅 컨텍스트와 경로 스택 관리core/setup.ts: 컨테이너 초기화, 컨텍스트 리셋, 루트 렌더 트리거Phase 3: DOM 인터페이스 구축
core/dom.ts: 속성/스타일/이벤트 적용 규칙, DOM 노드 탐색/삽입/제거Phase 4: 렌더 스케줄링
utils/enqueue.ts:enqueue,withEnqueue로 마이크로태스크 큐 구성core/render.ts:render,enqueueRender로 루트 렌더 사이클 구현Phase 5: Reconciliation
core/reconciler.ts: 마운트/업데이트/언마운트, 자식 비교, key/anchor 처리core/dom.ts: Reconciliation에서 사용할 DOM 재배치 보조 함수 확인Phase 6: 기본 Hook 시스템
core/hooks.ts: 훅 상태 저장,useState,useEffect, cleanup/queue 관리core/context.ts: 훅 커서 증가, 방문 경로 기록, 미사용 훅 정리기본 과제 완료 기준:
basic.equals.test.tsx,basic.mini-react.test.tsx전부 통과심화과제
Phase 7: 확장 Hook & HOC
hooks/useRef.ts: ref 객체 유지hooks/useMemo.ts,hooks/useCallback.ts: shallow 비교 기반 메모이제이션hooks/useDeepMemo.ts,hooks/useAutoCallback.ts: deep 비교/자동 콜백 헬퍼hocs/memo.ts,hocs/deepMemo.ts: props 비교 기반 컴포넌트 메모이제이션과제 셀프회고
아하! 모먼트 (A-ha! Moment)
이라 하고 AI 와의 Q&A 입니다어차피 코드에서 ‘node === parentNode’ 조건을 걸어서 삭제하기 때문에 직계 자손만 삭제하면 되는데!
Answer (AI): Instance는 VDom을 내포하고, VDom은 실제 DOM이 아닌 경우가 있다! Fragment와 Component는 실제 DOM이 아니다. 그 안에 있는 실제 DOM을 가져와 그것을 삭제해야한다. 그래서 ‘getDomNodes(instance)’ 를 호출해 하위 모든 children을 가져오는 것이다.Answer (AI): JSX를 변환하는 과정에서 자동으로 호출된다. 어떤 변환 함수를 부를지는 Vite에서 설정 가능하다.Answer (AI): JSX의 작동 방식 때문이다.기술적 성장
코드 품질
AI가 작성해서...(없습니다!)
학습 효과 분석
과제 피드백
리뷰 받고 싶은 내용
(없습니다!)