mini-chip / Ledress

쇼핑몰 입니다.
0 stars 0 forks source link

쇼핑몰 피드백 2 #2

Open DevelopSoo opened 2 months ago

DevelopSoo commented 2 months ago
  1. API 요청 시에는 useEffect에 넣는 것이 일반적입니다! DB에 진짜 상품이 없는 경우가 있다면 무한 렌더링 발생할 수 있습니다. https://github.com/mini-chip/Ledress/blob/117a063edeb072773b9450f6dc58c72baa59a887/src/page/ProductList.jsx#L10-L21

  2. 이렇게 해도 상관은 없으나 의도한 바로는 state인 productList를 return 부분에서 보여주고 정렬버튼 클릭 시 productList를 변경하는 것이 목적이었습니다. ex) setProductList(sortedProductList())

  3. 굳이 ProductList 컴포넌트를 두 번 두셨네요. 그냥 15번째 줄은 없어도 되지 않을까 싶습니다. https://github.com/mini-chip/Ledress/blob/117a063edeb072773b9450f6dc58c72baa59a887/src/App.jsx#L13-L15