-
Notifications
You must be signed in to change notification settings - Fork 31
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
[양성경] Sprint5 #120
The head ref may contain hidden characters: "react-\uC591\uC131\uACBD"
[양성경] Sprint5 #120
Conversation
[양성경] Sprint 1 & 2
|
질문
|
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.
현재 리액트 세팅할 때 사용한 것은 Create React App인데요, 이제 지원 종료된다고 합니다. React 공식 홈페이지에서도 추천 세팅방법에서 빠진지 꽤 되었고, 요즘은 Vite나 Next.js 기반으로 세팅하는게 가장 일반적인 듯 합니다. 참고 부탁드립니다.
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 fetchProducts = async () => { | ||
try { | ||
const response = await fetch( | ||
`https://panda-market-api.vercel.app/products?pageSize=${pageSize}` | ||
); | ||
const data = await response.json(); | ||
if (Array.isArray(data.list)) { | ||
setProducts(data.list); | ||
setSortProducts( | ||
data.list.sort((a, b) => b.favoriteCount - a.favoriteCount) | ||
); | ||
} else { | ||
console.error("API 응답 오류:", data); | ||
} | ||
} catch (error) { | ||
console.error("데이터 반환 오류:", 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.
const sortByFavorite = (items) => { | ||
if (!Array.isArray(items)) return []; | ||
return [...items].sort((a, b) => b.favoriteCount - a.favoriteCount); | ||
}; |
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.
아래 리뷰와 같이 데이터를 먼저 가져온 뒤 정렬하지 말고, API의 쿼리 파라미터를 이용해 정렬해주세요
요구사항
기본
공통
중고마켓
심화
공통
중고마켓 페이지
주요 변경사항
스크린샷
멘토님께
질문
미션 수행 관련