-
Notifications
You must be signed in to change notification settings - Fork 35
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 #167
The head ref may contain hidden characters: "React-\uC774\uC7AC\uC644-sprint5"
[이재완] Sprint5 #167
Conversation
…ithub-actions [Fix] delete merged branch github action
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,43 +1,10 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<html lang="ko"> |
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.
리뷰 반영 굳! 👍
async function getData() { | ||
const url = "https://panda-market-api.vercel.app/products"; | ||
const response = await fetch(url); | ||
const result = await response.json(); | ||
|
||
const data = result.list.map((items) => ({ | ||
id: items.id, | ||
title: items.name, | ||
description: items.description, | ||
price: items.price, | ||
image: items.images, | ||
favoriteCount: items.favoriteCount, | ||
createAt: items.createAt, | ||
})); | ||
|
||
return data; | ||
} |
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.
이 부분은 별도의 파일로 분리가 되면 좋겠어요! 예를들어 getData.js 을 아래 처럼 별도의 모듈로 만들어서 사용하는 방법은 확장성이나 유지보수에도 더 좋은 장점이 있어요.
const BASE_URL = 'https://panda-market-api.vercel.app';
export async function getData(orderBy, page, pageSize) {
const query = `orderBy=${orderBy}&page=${page}&pageSize=${pageSize}`;
const url = `${BASE_URL}/products?${query}`;
try {
const response = await fetch(url);
if (!response.ok) {
throw new Error('Failed to fetch products');
}
const body = await response.json();
return body.list.map((item) => ({
id: item.id,
title: item.name,
description: item.description,
price: item.price,
image: item.images,
favoriteCount: item.favoriteCount,
createAt: item.createAt,
}));
} catch (error) {
console.error('Error message');
throw error;
}
}
<li key={items.id}> | ||
<ProductListItem item={item} /> | ||
</li> |
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.
여기 key 값이 items.id
가 아니라 item.id
가 되어야해요. 각 고유한 id값을 주어야 하거든요.
function AllProductList({ items }) { | ||
return ( | ||
<div className="all-product-list"> | ||
<div className="label"> | ||
<div className="label-title">전체 상품</div> | ||
<div className="label-inputs"> | ||
<input | ||
className="search-input" | ||
type="text" | ||
placeholder="검색할 상품을 입력해주세요" | ||
></input> | ||
<button className="product-add-button">상품 등록하기</button> | ||
<select className="order-dropdown" name="order" id="order"> | ||
<option value="createAt" selected> | ||
최신순 | ||
</option> | ||
<option value="rating">좋아요순</option> | ||
</select> | ||
</div> | ||
</div> | ||
<ul className="items"> | ||
{items.map((item) => { | ||
return ( | ||
<li key={items.id}> | ||
<ProductListItem item={item} /> |
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.
단순 UI를 표현하는 컴포넌트를 잘 만들어주셨습니다! 👍
function Menu({ className, name, href }) { | ||
const classNames = `Menu ${className}`; | ||
return ( | ||
<div className="Menu-wrapper"> | ||
<a className={classNames} href={href}> | ||
{name} | ||
</a> | ||
</div> | ||
); | ||
} | ||
|
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.
여기 Menu 컴포넌트도 headless UI 처럼 잘만들어주셨어요! 👍
첫 리액트 도입인데, 훌륭하게 잘해주셨어요. 다음번 과제도 지금처럼 headless UI를 잘 활용해주시는 방향으로 화이팅입니다! 💪 |
이제는 git 충돌 안나게 잘해주셨네요! |
요구사항
기본
중고마켓
중고마켓 반응형
심화
주요 변경사항
멘토에게