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.
SPA Router
구현 핵심 포인트
SPA 방식의 라우팅을 구현하기 위해서 핵심 포인트는 사용자 시각의 URL은 변환 하지만 페이지 전환을 일어나지 않습니다.
<a>태그를 통한 이동은 페이지 전체를 새로고침하므로, 대신Link컴포넌트를 사용해 내부적으로 DOM 변환을 트리거합니다.Link는 URL과 DOM 변화를 연결하는 매처(Matcher)와 연동되어야 합니다.제약 상황
실제 React Router처럼 리액트의 기술을 이용하여 구현은 불가능합니다.
세부 처리 요약
URL의 변환은 어떻게 ?
변환은 어떻게 감지
고려 사항 : 미완성된 React 훅에 의존하여 setState를 통한 업데이트 방식은 적절하지 않다고 판단했습니다. setState 없이 원하는 시점에 this.update()를 호출하는 것이 과제였습니다.
매처는 어떻게 ?
동적 라우팅은 어떻게 ?
ACTIONS
Job :
Deploy :
useState boolean ? :
문제
조건부 렌더링 ( boolean ? : ) 수행 시 특정 케이스에서 렌더링이 정상적으로 이루어지지 않는 문제가 발생
원인 분석
컴포넌트 업데이트가 발생할 때 상태가 초기화되고 0부터 다시 카운팅되는 과정에서, 조건부 렌더링의
store.states[hookIdx]에 이미 값이 존재하여 새로운initialState값으로 적절하게 초기화되지 않는 문제를 확인initialState값이 기존 상태를 덮어쓰지 못함