[2팀 유윤우] Chapter 1-2. 프레임워크 없이 SPA 만들기#40
Open
yunwoo-yu wants to merge 15 commits into
Open
Conversation
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://yunwoo-yu.github.io/front_6th_chapter1-2/
기본과제
가상돔을 기반으로 렌더링하기
이벤트 위임
심화 과제
Diff 알고리즘 구현
과제 셀프회고
이번엔 Jsx가 추가 된 환경에서 SPA에서 Virtual DOM을 다루는 코어 코드를 학습했습니다.
테스트 코드가 존재해 순서대로 진행할 수 있었지만 만약 테스트 코드가 없는 환경에서 vNode를 생성하고 정규화한 뒤
Element를 생성하는 과정을 생각해낼 수 있었을까? 라고 한다면 시작하기가 굉장히 어렵지 않았을까 생각이 드는 과제였습니다.
AI는 최소한으로 사용하고자 했고 이해하지 못한 코드는 사용하지 않으려 노력했습니다! 개인적으로는 diff, event쪽 구현을 했지만 아직 꽤 어려운 부분인 것 같습니다.😅
전체적인 구조를 이해하려고 Jsx 플러그인 문서를 보며 커스텀 함수로 트랜스파일링되어 실행이 되는 부분부터 차근차근 되짚어보며 복기했고
개인적으로 한번 더 살펴보며 리팩토링을 진행해봤지만 반복 코드 한곳밖에 개선한 게 없는 것 같아 아쉬움이 조금 남는 것 같습니다.
이제 또 블로그에 기록하며 한번 더 살펴봐서 이해도를 높일 생각입니다. 유익하고 재밌는 과제 감사합니다. 🙇♂️
기술적 성장
WeakMap 활용
Virtual DOM + JSX 구조의 전체적인 실행 플로우
main 함수 호출로 initRender 실행
createVNode(<HomePage />)형태로 변환되어 renderElement 함수의 vNode로 전달된다.코드 품질
특히 만족스러운 구현
createElement, updateElement 에서 반복되지만 따로 만들어져있던 AttributeUpdate 함수를 하나로 합쳐 재사용해봤습니다.
리팩토링이 필요한 부분
학습 효과 분석
과제 피드백
리뷰 받고 싶은 내용
if(조건) {
... 내용
return
}
이런 여러개의 if return 형태와 if else if 중 뭐가 더 나은 코드라고 생각하시나요?