-
Notifications
You must be signed in to change notification settings - Fork 24
7주차 김채현 과제제출 #6
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
base: main
Are you sure you want to change the base?
7주차 김채현 과제제출 #6
Conversation
meteorqz6
left a comment
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.
과제하느라 고생하셨습니다~~ 코드 리뷰 반영해서 커밋 다시 해주세요🙂
src/utils/weather.js
Outdated
| // 밑에 코드 채워주세요 | ||
| return []; | ||
|
|
||
| const times = weatherData.hourly.time; |
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 { time, temperature_2m, weather_code } = weatherData;
src/utils/weather.js
Outdated
| const codes = weatherData.hourly.weather_code; | ||
| const result = []; | ||
| for (let i = 0; i < 12; i++) { | ||
| const str = parseInt(times[i].slice(11, 13), 10) + "시"; // parseInt: 문자열을 정수로 바꿔주는 함수 |
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.
개인적으로는 new Date(time[i]).getHours() + '시' 가 더 깔끔할 것 같아요
src/utils/weather.js
Outdated
| // 밑에 코드 채워주세요 | ||
| return []; | ||
|
|
||
| const dates = weatherData.daily.time; |
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 CurrentWeather = ({ weatherData, isLoading }) => { | ||
| if (isLoading) { | ||
| return <div>채워주세요</div>; | ||
| return <div>날씨 정보를 불러오는 중...</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.
스켈레톤 컴포넌트 적용해봐도 좋을 것 같아요
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.
temperature, code가 인덱스 0인 값으로 고정되어 있어서 현재 기온과 날씨 상태 표시되는 기능이 작동하지 않아요! 현재 기온과 날씨 상태 표시되도록 코드 수정해주세요
현재 날씨, 시간별 날씨, 일별 날씨를 표시하는 컴포넌트를 구현함.
각 데이터는 map 함수로 반복 렌더링됨.
getWeatherDescription는 날씨 코드를 한글 텍스트로 변환함.
formatHourlyData, formatDailyData 함수는 각각 시간별, 일별 데이터 형식으로 배열을 재구성함.