Open
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a restaurant management application, including features for listing, filtering, and adding restaurants via modals. The feedback focuses on improving robustness and code quality, such as preventing default form submission, using optional chaining for safer property access, correcting HTML attribute usage, fixing CSS class name mismatches, and optimizing performance by moving static data outside of component definitions.
| <div className="modal-backdrop"></div> | ||
| <div className="modal-container"> | ||
| <h2 className="modal-title text-title">새로운 음식점</h2> | ||
| <form > |
Comment on lines
+11
to
+15
| <h2 className="modal-title text-title">{selectedRestaurant.name}</h2> | ||
| <div className="restaurant-info"> | ||
| <p className="restaurant-info__description text-body"> | ||
| {selectedRestaurant.description} | ||
| </p> |
There was a problem hiding this comment.
selectedRestaurant가 undefined일 경우 속성에 접근할 때 에러가 발생하여 앱이 중단될 수 있습니다. 옵셔널 체이닝(?.)을 사용하여 안전하게 데이터를 렌더링하세요.
Suggested change
| <h2 className="modal-title text-title">{selectedRestaurant.name}</h2> | |
| <div className="restaurant-info"> | |
| <p className="restaurant-info__description text-body"> | |
| {selectedRestaurant.description} | |
| </p> | |
| <h2 className="modal-title text-title">{selectedRestaurant?.name}</h2> | |
| <div className="restaurant-info"> | |
| <p className="restaurant-info__description text-body"> | |
| {selectedRestaurant?.description} | |
| </p> |
| return <h1>Self-Paced React</h1>; | ||
| const [category, setCategory] = useState("전체"); | ||
| const [isOpen, setOpen]=useState(false); | ||
| const [restaurantDetail,setDetail]=useState(" "); |
| <h2 className="modal-title text-title">새로운 음식점</h2> | ||
| <form > | ||
| <div className="form-item form-item--required"> | ||
| <label htmlFor="category text-caption">카테고리</label> |
There was a problem hiding this comment.
| function Header({setAddBtnOn}) { | ||
| return ( | ||
| <header> | ||
| <h1 className="gnb_title text-title">점심 뭐 먹지</h1> |
Comment on lines
+5
to
+12
| const categoryImage = { | ||
| 한식: "../templates/category-korean.png", | ||
| 중식: "../templates/category-chinese.png", | ||
| 일식: "../templates/category-japanese.png", | ||
| 양식: "../templates/category-western.png", | ||
| 아시안: "../templates/category-asian.png", | ||
| 기타: "../templates/category-etc.png", | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
안녕하세요. 임규영 리뷰어님! 프론트엔드 4기 김동건입니다.
그리디에서 어느덧 4주차 미션까지 하게됐지만 여전히 미숙한것같습니다. 그리디 템포에 잘 따라갈수있도록 열심히 하겠습니다!
react에 대해 처음 배우게 됐는데 기본적인 HTML, CSS, JS로 코드를 짜는것과 분명 비슷하면서도 결이 다름을 느꼈습니다. HTML을 만드는데 JS를 섞어서 쓰는 느낌이었어서 기존에 HTML에서 id로 받고 js에서 document로 불러와서 실행하는것보다 훨씬 쉽고 편하게 느껴졌습니다! 그리고 useState라는 함수가 너무 신기했는데 useState를 통해서 변수에 새로운 값을 할당하면 전체적으로 화면이 업데이트가 되는 점이 화면 업데이트를 하는것도 처음엔 좀 낯설었지만 굉장히 편하다고 생각합니다!
이번 미션에서 3단계인 Event Handler까지 구현을 했습니다 미션에 맞춰 순서대로 화면을 컴포넌트별로 나눠서 app하나에 다 import/export를 하였고 data에 각 음식점의 이름, 설명, 카테고리를 담은 배열을 app에 export하여 CategoryFilter에서 선택한거에 따라 useState를 사용하여 바로 바뀐 category값을 RestaurantList에 전달하여 화면이 바뀌도록 하였습니다.
그리고 아이템을 클릭하면 useState로 isOpen값을 true restarurantsDetailModal화면이 열리거나 열렸을때 백드롭이나 닫기버튼을 누르면 isOpen값을 false로 바꾸어 닫히도록 구현했습니다
리뷰어님과의 티키타카를 통해 REACT에 더 가까이 다가가고 싶습니다. 다음주 화요일까지 열심히 수정하고 더 공부하겠습니다 감사합니다!
Directory Structure
view image
4.mp4