Skip to content

Conversation

@chaeehyeon
Copy link

현재 날씨, 시간별 날씨, 일별 날씨를 표시하는 컴포넌트를 구현함.
각 데이터는 map 함수로 반복 렌더링됨.
getWeatherDescription는 날씨 코드를 한글 텍스트로 변환함.
formatHourlyData, formatDailyData 함수는 각각 시간별, 일별 데이터 형식으로 배열을 재구성함.

Copy link
Member

@meteorqz6 meteorqz6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

과제하느라 고생하셨습니다~~ 코드 리뷰 반영해서 커밋 다시 해주세요🙂

// 밑에 코드 채워주세요
return [];

const times = weatherData.hourly.time;
Copy link
Member

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;

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: 문자열을 정수로 바꿔주는 함수
Copy link
Member

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() + '시' 가 더 깔끔할 것 같아요

// 밑에 코드 채워주세요
return [];

const dates = weatherData.daily.time;
Copy link
Member

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>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스켈레톤 컴포넌트 적용해봐도 좋을 것 같아요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

temperature, code가 인덱스 0인 값으로 고정되어 있어서 현재 기온과 날씨 상태 표시되는 기능이 작동하지 않아요! 현재 기온과 날씨 상태 표시되도록 코드 수정해주세요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants