-
Notifications
You must be signed in to change notification settings - Fork 0
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
[ 4주차 기본과제 ] Github Profile Finder #6
base: main
Are you sure you want to change the base?
Conversation
- Finder에서 엔터 이벤트가 발생 하였을시 input.value값을 부모 컴포넌트에 전달하여 username에 해당하는 정보를 가져옴. - username에 해당하는 정보가 없거나 요청시 에러가 발생할 경우 에러처리. - 요청성공시 최신검색에 username을 저장할 githubUserList에 username을 할당 & 해당 user의 데이터를 저장하는 githubData에 정보를 할당.
- handleOnClick : input창이 클릭 될 시 최신검색기록이 보여짐(hidden=false)로 변경. - handleOutside : input창 외에 다른 부분 클릭 시 최신검색기록 사라짐(hidden=true)로 변경. - 보여짐(!hidden)의 경우 map을 이용하여 최신검색기록에 있는 username을 컴포넌트를 이용하여 출력.
- 클릭 이벤트가 발생한 형제요소의 innerText를 props로 받아온 deleteUsername에 전달해주어 해당하는 이름을 githubSearchList에서 제거한다
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.
고생했어 !!! 골머리 앓았겠다
다른 파트원들 코드 보면서, router 를 이용해서 어떻게 데이터를 주고받았나 확인해보면 좋을 것 같아 !~
@@ -0,0 +1 @@ | |||
# 안녕 나는 홍명헌이야~ |
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.
HI~
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.
이번주 과제도 역시 잘 해주셨네요 최고짱짱
.then((resopnse) => { | ||
if (resopnse['status'] === 200) { | ||
setGithubData(resopnse['data']); | ||
setGithubSearchList((prev) => [ | ||
...new Set(prev).add(username), | ||
]); | ||
setOpenContent(true); | ||
} | ||
}) | ||
.catch((error) => { |
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.
요기서는 catch에서 에러를 잡아주고 있어서 19번째 조건문은 없어도 될 것 같아요
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.
아 .then이 성공했을 때 실행이 될테니 이 말이 맞군요!!반영하겠습니당!!
<Finder | ||
bringUsername={bringUsername} | ||
githubSearchList={githubSearchList} | ||
deleteUsername={deleteUsername} | ||
></Finder> |
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.
컴포넌트 태그 사이에 특정 요소를 넣어주고 있지 않다면 <Finder />
요렇게 클로징 태그로 써주면 어떨까요?
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.
아 맞네요!! 반영하겠습니다!!ㅎㅎㅎ
const { githubData, deleteContent } = props; | ||
return ( | ||
<ContentContainer> | ||
<Outlet /> |
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.
중첩 라우팅 이렇게 편하게 할 수 있었군요~ 꿀팁 알아가요 👍👍👍
근데 지금 Content 컴포넌트가 /search 경로에 있는 Main 컴포넌트 안에서 중첩 라우팅이 되고 있으니까
Content 컴포넌트가 아니라 Main 컴포넌트에서 Outlet을 사용해야 하는 것 같은데 제가 이해한 게 맞을까요??
✨ 구현 기능 명세
🎁 PR Point
-Finder
😭 소요 시간, 어려웠던 점
약8시간..?
😎 구현 결과물
Uploading 화면 기록 2022-11-11 오후 5.44.28.mov…