-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3팀 허원영] [Chapter 1-2] 프레임워크 없이 SPA 만들기 #48
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한 주도 고생하셨습니다ㅎㅎ
if (!container._oldVNode) { | ||
container._oldVNode = null; | ||
} | ||
|
||
const normalizedVNode = normalizeVNode(vNode); | ||
if (!container._oldVNode) { | ||
container.appendChild(createElement(normalizedVNode)); | ||
} else { | ||
updateElement(container, normalizedVNode, container._oldVNode); | ||
} | ||
|
||
setupEventListeners(container); | ||
container._oldVNode = normalizedVNode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 변수를 따로 만들어둔 다음에 oldVNode를 저장해뒀는데, container에 _oldVNode를 프로터피 바인딩을 사용하는 방식이 더 깔끔해보이는 것 같아요!
target.setAttribute("class", newProps[key]); | ||
} else if (key.startsWith("on") && typeof newProps[key] === "function") { | ||
const eventName = key.toLowerCase().substring(2); | ||
// removeEvent(target, eventName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 주석은 항상 지워두는 편인데, 예전에 다니던 회사에서는 남겨두는 경우도 많이 본 것 같아요..!
원영님은 주석에 대해서 어떻게 생각하시는지 궁금합니다ㅎㅎ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사실 저런 주석은 지우는게 맞는거 같아요 ㅋㅋ 코치님도 사용하지 않는 주석을 지우라고 피드백 주셨더라구요...
@@ -53,5 +53,26 @@ export const globalStore = createStore( | |||
userStorage.reset(); | |||
return { ...state, currentUser: null, loggedIn: false }; | |||
}, | |||
likePost(state, postId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이번주 수고하셨습니다. 좋아요 기능을 여기서 관리하는게 깔끔하군요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
역시 프짱...
직접 구현하려고 노력하신 흔적이 보이는 PR이었습니다.
이번 한 주도 고생하셨습니다~!! 👏
export const PostForm = () => { | ||
const { addPost } = globalStore.actions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
createStore에 actions도 따로 정의가 되어 있었군요! 🤩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | ||
* @typedef {Object} VNode | ||
* @property {string|function} type - 요소의 타입 | ||
* @property {Object | null} props - 요소의 속성 | ||
* @property {Array<*>} children - 요소의 자식 노드 | ||
*/ | ||
|
||
function updateAttributes($el, props) {} | ||
export function createElement(vNode) { | ||
if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
원영님 코드를 보면 코드 자체도 읽기 편한데 주석도 굉장히 잘 작성되어 있네요...!👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
감사합니다 ㅎㅎ
과제 체크포인트
기본과제
가상돔을 기반으로 렌더링하기
이벤트 위임
심화 과제
1) Diff 알고리즘 구현
2) 포스트 추가/좋아요 기능 구현
과제 셀프회고
기술적 성장
코드 품질
학습 효과 분석
과제 피드백
리뷰 받고 싶은 내용