-
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
[염정훈] Sprint8 #244
The head ref may contain hidden characters: "React-\uC5FC\uC815\uD6C8-sprint8"
[염정훈] Sprint8 #244
Conversation
"@types/jest": "^27.5.2", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", |
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.
@types
관련 의존성들은 devDependancy
에 설치를 해주세요.
devDependency
에 설치된 의존성 파일들은 최종 빌드시에 포함되지 않아 번들 사이즈가 줄어듭니다.
interface FormData { | ||
name: string; | ||
info: string; | ||
price: string; | ||
tag: string; | ||
} |
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.
👍
interface Product { | ||
id: number; | ||
name: string; | ||
info: string; | ||
price: number; | ||
tag: string; | ||
images: string; | ||
favoriteCount: number; | ||
} |
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 문서에 나와 있는 Product의 데이터 구조를 그대로 작성해주시는것이 좋을 것 같습니다.
아래의 구조를 따라서 Product
의 데이터 타입을 완성해주세요.
특히 tag
는 string 타입이 아니라 string의 배열
타입이네요 ~
{
"createdAt": "2024-08-05T08:25:27.138Z",
"favoriteCount": 0,
"ownerId": 1,
"images": [
"https://example.com/..."
],
"tags": [
"전자제품"
],
"price": 0,
"description": "string",
"name": "상품 이름",
"id": 1
}
interface Product { | ||
id: number; | ||
name: string; | ||
info: string; | ||
price: number; | ||
tag: string; | ||
images: string; | ||
favoriteCount: number; | ||
} |
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.
AllProduct에서 Product
타입을 정의를 했으니까 그 타입을 재사용해야합니다. AllProduct
에서 정의한 타입을 가져와서 재사용해주세요.
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.
Writer
, Product
, Comment
꼼꼼한 타입지정 잘 하셨네요. UI를 구성하기 위한 객체는 왠만하면 다 타입지정을 해주시는게 좋습니다. 다만 Product타입은 다른 페이지에서 많이 사용되고 있으니 재사용을 해주세요.
const [products, setProducts] = useState<Product[]>([]); | ||
const [page, setPage] = useState<number>(1); | ||
const [pageSize, setPageSize] = useState<number>(10); | ||
const [order, setOrder] = useState<string>(RECENT); | ||
const [dropArrow, setDropArrow] = useState<string>(""); | ||
const [dropDisplay, setDropDisplay] = useState<string>("none"); | ||
const [orderTxt, setOrderTxt] = useState<string>("최신순"); | ||
const [pagesNum, setPagesNum] = useState<number[]>([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.
useState
에 상태들의 꼼꼼한 타입 명시 좋습니다 !!
스프린트 미션 수고하셨습니다. 전반적으로 타입을 잘 만드셨고, 타입 재사용을 좀 더 적극적으로 하시면 될 것 같습니다 ! |
요구사항
기본
주요 변경사항
멘토에게