Skip to content

Conversation

@cnnnnh
Copy link

@cnnnnh cnnnnh commented Dec 27, 2019

도저히 모르겠어서 일단 제출합니다 ㅠ_ㅠ

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.

B+ 드립니다.

잘 시도해주셨습니다. 지난 시간에 배우신 내용들은 잘 숙지하고 계신 것 같습니다.

커맨트 드린바와 같이 삼항연산자와 &&, || 를 사용해보시면 더욱 좋을 것 같습니다.
https://reactjs.org/docs/conditional-rendering.html

{id: 2, title: "title3", content: "default3"}
{id: 0, title: "title1", content: "default1", isFocused: false},
{id: 1, title: "title2", content: "default2", isFocused: false},
{id: 2, title: "title3", content: "default3", isFocused: false}
Copy link
Owner

Choose a reason for hiding this comment

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

isFocused는 note 내부에 state로 관리하는 편이 더 깔끔할 것 같습니다. app에서 isFocused를 알고 있지 않아도 되기 때문입니다. 답안을 참고해주세요.

{this.state.savedNotes.map((note, index) => (
<Note
delete={this.delete}
edit={this.isFocused}
Copy link
Owner

Choose a reason for hiding this comment

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

코드 작성중에 끊기셔서 이런 부분이 나온 것 같습니다.

this.setState({
isEditFocused: false
})
console.log(this.props.index + "is not focused")
Copy link
Owner

Choose a reason for hiding this comment

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

처음에는 이렇게 리뷰를 달면서 작업하는게 좋습니다. 잘하셨습니다.

render() {
const {title, content} = this.props
const editFocus = this.state.isEditFocused
if (!editFocus) {
Copy link
Owner

Choose a reason for hiding this comment

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

이 부분은 삼항연산자를 활용하는 것을 연습해보시면 더 좋을 것 같습니다.

마찬가지로 && 와 || 도 활용해보세요.(답안을 참고하시면 사용 예제가 있습니다.

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