-
Notifications
You must be signed in to change notification settings - Fork 1
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
feature/complete: complete 화면 #29
Conversation
dust를 모두 잡았을 때 컴플리트 창 띄우기 #15
✅ Deploy Preview for glowing-cucurucho-52dcb2 ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
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.
코드 구현을 하셨으니 문제는 없지만 사실 React에서 화면에 나오는 친구들에 변동사항이 생길 수 있으면 let으로 변수 선언을 해주면 안되고 useState로 관리해주셔야합니다.
마찬가지로 for문도 좋은 선택은 아닙니다
for문이 좋은 선택이 아닌 이유는
-
모든 배열을 순환한다는 보장을 할 수 없다.
나중에 혹시 먼지가 5개가 아니라 6개가 된다면 코드를 다시 바꿔줘야할 것 입니다. -
let이라는 변수가 특수한 상황 아니면 안나오는게 좋구요.
예를들면 지금 이 상황에서 혹시 i가 초기화 되지 않아서 6,7 8 ... 더 큰 숫자가 되지 말라는보장이 없습니다.
저도 코드가 막 떠오르진 않지만
const isFinish = response.data.result.dustInfo.every(item => item.cauthgt === true)
인런식으로 작성했어도 동일했을 것 같습니다
|
||
if (response.status == 200) { | ||
if (response.data.code == 200) { | ||
setDusts(response.data.result.dustInfo); | ||
} | ||
} | ||
|
||
console.log(response); |
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.
콘솔로그 제외해주세요
} | ||
if (count == 5) { | ||
onCatchChange(); | ||
console.log(count); |
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.
여기도 콘솔로그 지워주세요
count++; | ||
} | ||
} | ||
if (count == 5) { |
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.
count >= 5로 합시다 혹시 count 가 5보다 커질 가능성도 있습니다(오류로 인하여)
그리고 count == 5로 하고싶다면 count === 5로 해주셔야 타입정확성까지 얻을 수 있습니다
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.
위에 리스폰스도 마찬가지로 === 200으로 해주세요
dust를 모두 잡았을 때 컴플리트 창 띄우기
#15
최근 작업 주제 (하나 이상의 주제를 선택해주세요.)
구현 사항
미션 컴플리트 구현
구현한 것에 대해 설명해주세요.
사진이나 동영상을 함께 첨부해주면 좋습니다!
기타
혹시 개발 하면서 조금 문제가 있는 것이 있었다면 써주고, 궁금한 것이나, 코드를 볼 때 참고해야하는 것이 있으면 적어주세요!