Skip to content

React basic CRUD & prettier#2

Open
DDuckyee wants to merge 3 commits intodevelopfrom
feature/test
Open

React basic CRUD & prettier#2
DDuckyee wants to merge 3 commits intodevelopfrom
feature/test

Conversation

@DDuckyee
Copy link
Copy Markdown
Owner

@DDuckyee DDuckyee commented Jun 9, 2023

React basic CRUD and prettier

Copy link
Copy Markdown
Collaborator

@ZERO-black ZERO-black left a comment

Choose a reason for hiding this comment

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

수고하셨습니다.
아직 구조가 잡혀 있지 않아서 관련된 피드백은 생략했습니다.

  1. 재서님과 상의해서 디자인 패턴 적용해주세요.
  2. 주석이 한 줄도 없습니다. 어렵지 않은 코드라도 주석 남기는 습관 들이면 좋을거 같아요.

디자인 패턴 적용해서 다시 확인 받은 뒤 머지하는게 좋을 것 같습니다.

toy/src/App.js Outdated
Comment on lines +146 to +151
for (let i = 0; i < topics.length; i++) {
if (topics[i].id === id) {
title = topics[i].title;
body = topics[i].body;
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. break를 걸 수 있을거 같아요.
  2. 사실 이럴 때 사용할 수 있는 filter 메소드가 있습니다. 뭔가 구현하기 전에 기존 메소드를 활용할 수 있을지 MDN문서 한번 읽어보시는 것도 좋을거 같네요. 참고
  3. 밑에 로직에도 다 적용해주세요.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

한번 읽어보겠습니다!

toy/src/App.js Outdated
Comment on lines +24 to +40
for (let i = 0; i < props.topics.length; i++) {
let t = props.topics[i];
lis.push(
<li key={t.id}>
<a
id={t.id}
href={"/read/" + t.id}
onClick={(event) => {
event.preventDefault();
props.onChangeMode(Number(event.target.id));
}}
>
{t.title}
</a>
</li>
);
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

여기는 map을 사용할 수 있습니다.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

넵, 감사합니다

toy/src/App.js Outdated
Comment on lines +189 to +191
const newTopics = [...topics];
newTopics.push(newTopic);
setTopics(newTopics);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  1. 스프레드 연산자로 바로 이어 붙일 수 있습니다. (따로 push 할 필요 없음)
  2. state를 업데이트할 때 기존 state를 직접 가져다가 쓰는 방식�은 적합하지 않습니다.
    참고 - 리액트 공식문서

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

이해했습니다.
함수를 따로 만드는 게 안전하겠네요!

Copy link
Copy Markdown
Collaborator

@jaeseo222 jaeseo222 left a comment

Choose a reason for hiding this comment

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

수고 많으셨습니다!!! ☺️☺️

Comment on lines +10 to +13
onClick={(event) => {
event.preventDefault();
props.onChangeMode();
}}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

onClick 같은 이벤트에 바로 arrow 함수를 넣는 것도 좋은데,
나중에 재사용성을 위해서 함수로 따로 빼줘도 좋을 것 같아요!

보통 저는 함수 이름을 이벤트+함수가 하는 일 로 짓습니다. 협업 시, 일관성과 가독성을 위해 말씀드립니다!! ✨

예를 들어, 시나리오를 수정하는 onClick이벤트 같은 경우엔 onClickEditScenario 처럼요!!!
밑에 있는 onSubmit 이벤트 같은 것들도요...

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

넵 감사합니다 👍

Comment on lines +64 to +65
const title = event.target.title.value;
const body = event.target.body.value;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

아래와 같이 key에 바로 접근하는 방식도 좋을 것 같아요!
const { title, body } = event.target;

@jaeseo222
Copy link
Copy Markdown
Collaborator

디자인 패턴 관련해서는 아직 상의한 적 없지만,
LALA는 우선 Atomic 패턴(재사용 가능한 컴포넌트들의 집합"인 디자인 시스템)을 활용하는 중입니다! front 레포의 readme에 작성 해 놓았습니다.

@Nicered
Copy link
Copy Markdown
Collaborator

Nicered commented Jun 19, 2023

Conflict 수정 완료

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.

4 participants