-
Notifications
You must be signed in to change notification settings - Fork 35
2주차 과제 입니다 - 문학주 #55
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: 2week
Are you sure you want to change the base?
2주차 과제 입니다 - 문학주 #55
Conversation
yesjin-git
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.
어려운 과제였는데 정말 고생해 주셨습니다. 주로 참고하실 만한 부분들에 대해 커맨트 달아드렸습니다. 자세한 구현에 관한 내용은 답지 공유드리도록 하겠습니다.
커맨트가 늦어져서 죄송합니다. 점수는 A-입니다.
| // console.log(savedNotes); | ||
|
|
||
| // 파라미터로 받은 id 를 가지고 몇번째 아이템인지 찾습니다. | ||
| const indexes = savedNotes.findIndex(note => note.id === index); |
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.
findindex함수는 ie에서 사용이 불가합니다. (ie12 즉 edge부터 지원) 이 경우에 호환성을 유지하려면 babel셋팅이 필요합니다. babel-polyfill이 해당 함수를 위해 필요한 dependency입니다. 종종 리액트로 개발하다 보면, 리액트 환경과 babel setting에 따라 호환성 문제가 발생하는 경우가 있습니다. 이런 경우에는 babel에서 ie환경에서도 js 가 활용가능하도록 하는 설정을 해주시면 됩니다.
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.
https://babeljs.io/docs/en/babel-polyfill
요 링크에 해당 내용에 대한 설명이 있습니다. 현재 시점으로 보니 babel-core 에 해당 기능이 추가되어 굳이 해당 작업을 할 필요는 없어진 것 같습니다.(react버전이나 셋팅에 따라 다를 수 있으나 아마 보통 셋팅이 자동으로 돼 있을 것 같습니다.)
아래는 제가 자주 이용하는 호환성 체크 사이트입니다. 참고하세요. ㅎㅎ
https://caniuse.com/#search=findindex
| } | ||
|
|
||
|
|
||
| normal = (index) =>{ |
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.
normalize 혹은 setNormal 와 같은 동사로 써주는게 혼돈을 줄일 수 있을 것 같습니다.
| <span className="card-title"> | ||
|
|
||
|
|
||
| { status ? (<EditText title={title} index={this.props.index} content={content} handleClickNormal={this.handleClickNormal} editSave={this.props.editSave} />) : ( <> {title}<br />{content} </>)} |
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 문) ? (
aaa
) : (
aaa
)
참고 :
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Conditional_Operator
No description provided.