Skip to content

Conversation

@mhj6380
Copy link

@mhj6380 mhj6380 commented Nov 2, 2019

No description provided.

@Jravvit Jravvit requested a review from yesjin-git November 8, 2019 11:16
Copy link
Owner

@yesjin-git yesjin-git left a 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);
Copy link
Owner

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 가 활용가능하도록 하는 설정을 해주시면 됩니다.

Copy link
Owner

Choose a reason for hiding this comment

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

https://stackoverflow.com/questions/36196592/why-do-we-need-to-use-import-babel-polyfill-in-react-components

https://babeljs.io/docs/en/babel-polyfill
요 링크에 해당 내용에 대한 설명이 있습니다. 현재 시점으로 보니 babel-core 에 해당 기능이 추가되어 굳이 해당 작업을 할 필요는 없어진 것 같습니다.(react버전이나 셋팅에 따라 다를 수 있으나 아마 보통 셋팅이 자동으로 돼 있을 것 같습니다.)

아래는 제가 자주 이용하는 호환성 체크 사이트입니다. 참고하세요. ㅎㅎ
https://caniuse.com/#search=findindex

}


normal = (index) =>{
Copy link
Owner

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} </>)}
Copy link
Owner

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

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