-
Notifications
You must be signed in to change notification settings - Fork 8
[2주차] 박규빈 학습&TodoList 제출 #7
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: main
Are you sure you want to change the base?
Conversation
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.
수고하셨습니다!
week2/박규빈/todo/src/App.jsx
Outdated
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.
id를 Date.now()
로 하신 이유를 알려주세요!
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.
아직 간단한 형태로만 만들었는데, Date.now()를 통해서 할 일을 추가하는 순간마다 다 다른 값을 가지도록 해서, 새로운 할 일이 추가될 때마다 겹치지 않도록 id를 설정해놨습니다.
이후 추가적으로 입력된 할 일이 등록된 시간이 적히도록 코드를 수정하겠습니다.
week2/학습내용.md
Outdated
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.
왜 함수로 수정해야 할까요?
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가 가장 최신 상태의 값을 가져와서 계산할 수 있기 때문이라고 알고 있습니다.
week2/박규빈/todo/src/index.css
Outdated
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.
Pretendard가 없는 환경에서도 잘 보일 수 있도록 웹폰트를 추가하시면 좋을 것 같아요!
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.
감사합니다. 추후 수정하도록 하겠습니다 !!
week2/박규빈/todo/src/App.jsx
Outdated
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.
e.preventDefault();
의 역할은 무엇인가요?
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.
html의
태그에서 기본 동작을 막아주는 역할로 알고 있습니다.preventDefault를 넣지 않는다면, 텍스트 입력 후 추가 버튼을 누르면 입력된 내용이 할 일로 생성되자마자 바로 페이지가 새로고침되는데, preventDefault를 넣는다면 페이지 전체가 새로고침이 안되기 때문에 해당 코드를 사용했습니다.
(입력한 할 일이 그대로 남아있기 때문 !!)
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.
고생 많으셨습니다! 투두리스트를 만드실 때, 컴포넌트 분리를 하셨던데 왜 분리하셨는지, 왜 이렇게 분리하셨는지 궁금합니다!
week2/학습내용.md
Outdated
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.
왜 하나의 부모 요소로 감싸야 할까요? 만약에 감싸지 않는다면 어떻게 될까요?
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.
우선 컴포넌트 분리는 기능별로 코드를 나눠서 보면 가독성도 좋아지고 나중에 수정하기도 편할 것 같아서 분리했고,
JSX 문법상 return문 안에서는 하나의 요소만 반환할 수 있기 때문입니다. 부모 요소로 감싸지 않으면 에러가 발생합니다 !
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.
고생하셨습니다!
week2/박규빈/todo/src/App.jsx
Outdated
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.
trim()을 사용하신 이유가 뭔가요?
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.
사용자가 공백만 입력하거나, 입력값의 양 끝에 있는 불필요한 공백을 제거하고자 사용했습니다!!
week2/학습내용.md
Outdated
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.
왜 css속성은 카멜 케이스로 작성해야 할까요?
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에서 스타일을 적용할 때 JavaScript 문법을 따르기 때문이라고 알고 있습니다 !!
예를 들어 background-color는 JavaScript에서 빼기 연산으로 인식될 수 있어서 backgroundColor로 사용합니다.
✅ 학습 내용 요약
🤔 고민했던 부분