-
Notifications
You must be signed in to change notification settings - Fork 37
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
[1단계 - 계산기] 밧드(감우영) 미션 제출합니다. #12
Conversation
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
Co-authored-by: JASUN LEE <liswktjs@users.noreply.github.com>
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.
안녕하세요 밧드! 이번 계산기 미션의 리뷰어 헤인티입니다. 만나게 되어 반갑습니다 :)
전체적으로 코드가 깔끔하네요~! 간단하게 피드백 남겼으니 확인해봐주시면 됩니다!
1단계 고생하셨구 2단계에서 봬요!
|
||
### `npm run build` fails to minify | ||
|
||
This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) |
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.
리드미는 정리하면 좋겠네요!
"last 1 safari version" | ||
] | ||
} | ||
} |
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.
프리티어, 린트 패키지들이 추가되면 좋겠네요!
@@ -0,0 +1,17 @@ | |||
import React, { Component } from 'react'; |
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 18 에서는 import React from 'react'
생략이 가능합니다!
import React, { Component } from 'react'; | |
import { Component } from 'react'; |
class Calculator extends Component { | ||
constructor() { | ||
super(); | ||
window.addEventListener('beforeunload', this.confirmExist); |
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.
이 리스너는 언제 해제될까요?
prevNumber: [], | ||
operator: '', | ||
nextNumber: [], |
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.
prevNumber
-> prevNumbers
, nextNumber
-> nextNumbers
복수 표현해주세요~
try { | ||
if (isPrev) { | ||
if (this.state.prevNumber.length >= NUMBER_LIMIT) { | ||
throw new Error(ERROR_MSG.OVER_NUMBER_LIMIT); | ||
} | ||
this.setState({ prevNumber: [...this.state.prevNumber, number] }); | ||
return; | ||
} | ||
if (this.state.nextNumber.length >= NUMBER_LIMIT) { | ||
throw new Error(ERROR_MSG.OVER_NUMBER_LIMIT); | ||
} | ||
this.setState({ nextNumber: [...this.state.nextNumber, number] }); | ||
} catch ({ message }) { | ||
alert(message); | ||
} |
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.
불필요한 try-catch 와 같이 댑스가 깊어지는 일은 피해주세요~!
try { | |
if (isPrev) { | |
if (this.state.prevNumber.length >= NUMBER_LIMIT) { | |
throw new Error(ERROR_MSG.OVER_NUMBER_LIMIT); | |
} | |
this.setState({ prevNumber: [...this.state.prevNumber, number] }); | |
return; | |
} | |
if (this.state.nextNumber.length >= NUMBER_LIMIT) { | |
throw new Error(ERROR_MSG.OVER_NUMBER_LIMIT); | |
} | |
this.setState({ nextNumber: [...this.state.nextNumber, number] }); | |
} catch ({ message }) { | |
alert(message); | |
} | |
const { prevNumber, nextNumber } = this.state; | |
if (prevNumber.length >= NUMBER_LIMIT || nextNumber.length >= NUMBER_LIMIT) { | |
alert(ERROR_MSG.OVER_NUMBER_LIMIT); | |
return; | |
} | |
if (isPrev) { | |
this.setState({ prevNumber: [...this.state.prevNumber, number] }); | |
return; | |
} | |
this.setState({ prevNumber: [...this.state.prevNumber, number] }); |
{Array.from({ length: 10 }).map((_, index) => ( | ||
<NumberButtons key={index} func={this.onClickNumber} number={-(index - 9)} /> | ||
))} |
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.
👍
데모페이지
계산기 미션 제출합니다.
🎯 기능 요구사항
필수 요구사항