-
Notifications
You must be signed in to change notification settings - Fork 9
[6주차] Team 하니홈 신수진&원채영 미션 제출합니다. #13
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
base: master
Are you sure you want to change the base?
Conversation
✨ feat: 레이아웃 컴포넌트 구현 및 404 페이지 구현
feat: 넷플릭스 랜딩페이지 구현
✨ feat: detail 페이지 제작 및 링크 추가
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.
스켈레톤이랑 오디오도 넣은 팀이라 저번 발표에서 인상깊었어요. 수고하셨습니다~
export const metadata: Metadata = { | ||
title: "Netflix", | ||
description: "CEOS 21th NETFLIX Clone Coding", | ||
robots: "index, follow", | ||
authors: [{ name: "Sujin" }, { name: "Chaeyoung" }], | ||
icons: { | ||
icon: "/icons/favicon.svg", | ||
}, | ||
openGraph: { | ||
title: "Netflix Clone", | ||
description: "CEOS 21th NETFLIX Clone Coding by SuyoungSwim", | ||
url: "https://next-netflix-21th-suyoungswim.vercel.app", | ||
siteName: "Netflix Clone", | ||
type: "website", | ||
}, | ||
}; |
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 handleStart = () => { | ||
setStarted(true); | ||
audioRef.current?.play(); | ||
}; |
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.
useEffect 사용하여 페이지 입장 시 바로 재생하지 않고 클릭 시 재생으로 하신 이유가 있으실까요?
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.
넷플릭스 로고에 마우스를 올렸을 때 음악이 재생되도록 해보려 했는데, 브라우저 보안 정책 때문에 사용자 액션 없이 자동 재생이 막히더라고요! 그래서 클릭 시 재생되도록 방식만 조금 바꿨습니다 :)
import ComingSoonIcon from "@/public/icons/bottomNavBar/ComingSoonIcon.svg"; | ||
import DownloadIcon from "@/public/icons/bottomNavBar/DownloadIcon.svg"; | ||
import HomeIcon from "@/public/icons/bottomNavBar/HomeIcon.svg"; | ||
import MoreIcon from "@/public/icons/bottomNavBar/MoreIcon.svg"; | ||
import SearchIcon from "@/public/icons/bottomNavBar/SearchIcon.svg"; |
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.
chatgpt에서 svgr 라이브러리를 사용할 거면 svg 파일을 src 하위에서 관리하는 게 낫다고 하더라고요.
svg를 image 컴포넌트로 렌더링할 거면 public 하위에서 관리하는 게 최적화가 알아서 된다고 하네요.
if (loading) { | ||
return ( | ||
<SkeletonCard | ||
title="Previews" | ||
itemWidth="102px" | ||
itemHeight="102px" | ||
shape="circle" | ||
/> | ||
); | ||
} |
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.
스켈레톤을 loading 상태를 관리하시면서 구현하셨군요. 저는 Suspense 사용해보려다가 안되더라고요...
과제를 하며
지난 주차에는 랜딩 페이지와 홈 페이지까지만 작업을 진행했기 때문에, 이번 주차 과제에서는 검색 페이지와 상세 페이지를 두 역할로 나누어 분담해 진행하였습니다. 과제 발표 과정에서 받은 피드백과 코드 리뷰를 바탕으로 코드를 다시 점검하며 리팩토링을 진행했고, 이 과정에서 API 함수 수정도 함께 이루어졌습니다. 자연스럽게 역할이 정리되면서, 수진님은 리팩토링이 필요한 API 코드와 관련된 상세 페이지를, 저는 검색 페이지를 맡아 구현하게 되었습니다.
배포 링크
🔗 넷플릭스 TEAM 하니홈
Key Questions
정적 라우팅(Static Routing)/동적 라우팅(Dynamic Routing)이란?
useRouter
또는Link
컴포넌트를 사용해 고정된 경로로 이동한다.[param]
)를 사용해 동적인 값을 받을 수 있는 페이지를 생성한다.useRouter()
또는useParams()
등을 통해 라우터 객체에서 쿼리 값으로 접근할 수 있다.무한 스크롤과
Intersection Observer API
의 특징에 대해 알아봅시다.무한 스크롤:
(장점)
(단점)
Intersection Observer API:
element
)가 뷰포트(viewport)와 교차되는지 여부를 감시하는 Web API기존 방식과의 차이점
throttle
함수를 함께 사용하여, 일정 주기마다 한 번만 이벤트가 발생하도록 제한합니다.사용방법:
new IntersectionObserver(callback, options)
를 사용해 관찰자 객체 생성.observe(targetElement)
를 호출해 관찰 대상 등록options
에는 아래 3가지 속성을 설정할 수 있음:null
(즉, 브라우저 viewport)'0px 0px 0px 0px'
0
~1
사이의 숫자. 기본값:0
콜백 함수 형식
callback(entries, observer)
형식entries
: 관찰 중인 모든 요소들의 상태 정보가 배열로 전달됨observer
: 해당IntersectionObserver
인스턴스entries.forEach(entry => ...)
형태로 개별 요소 접근tanstack query
의 사용 이유(기존의 상태 관리 라이브러리와는 어떻게 다른지)와 사용 방법(reactJS와 nextJS에서)을 알아봅시다.서버에서 데이터를 받아와 화면에 표시하고, 캐싱 및 동기화를 자동화하는 데 특화된 도구이다.
tanstack query의 대표적 기능
데이터 가져오기 및 캐싱
queryKey
)를 지정함동일 요청의 중복 제거
queryKey
를 가진 여러 컴포넌트가 동시에 렌더링되더라도 서버 요청은 단 한 번만 발생.신선한 데이터 유지
캐시된 데이터가 신선하다면 캐시된 데이터를 사용하고, 만약 데이터가 상했다면 서버에 다시 요청해 새로운 데이터를 가져오는 방식으로 데이터의 신선도를 유지
staleTime
을 통해 캐시된 데이터의 유효기간을 설정할 수 있음isStale
값으로 신선도 여부 확인 가능무한 스크롤, 페이지네이션 등의 성능 최적화
useInfiniteQuery
를 사용하면 스크롤 기반 로딩이나 페이지네이션을 쉽게 구현할 수 있음네트워크 재연결, 요청 실패 등의 자동 갱신
요청 실패 시 자동 재시도
네트워크 재연결 시 자동 갱신
추가적으로
refetchInterval
같은 경우 일정 주기로 데이터 자동 갱신 가능함 (ex. 실시간 가격 등)