Skip to content

Conversation

@hyungchunKim
Copy link

코드리뷰입니다.


const handleSubmit = (e) =>{
e.preventDefault();
let date = new Date();
Copy link
Author

Choose a reason for hiding this comment

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

변수명 date, month, day 를 선언하고 초기화 해주셨는데 이중에서 date만 let으로 변수로 선언하고 month,day는 상수로 선언하신 특별한 이유가 있을까요?? 일단 1차적으로 제가 생각했을 때는 date 값이 new Date() 함수를 호출한 값을 반환 받게 되니까 계속 값이 초기화 될수 있어서 let으로 선언하셧나?? 라고 생각을 했는데 그렇게 생각해보면 month와 day도 결국은 값이 바뀌게 되지 않나 싶어서요..! 아니면 제가 변수와 상수의 개념을 약간 잘못 이해하고 있는 것일 수도 있어서 혹시라도 특별한 이유가 있으시다면 알려주시면 감사하겠습니다!

const [isEditing, setIsEditing] = useState(false);
const [editedContent, setEditedContent] = useState(content);

//넘기는 인자값이 많을 경우 함수를 생성해서 할수도 있음
Copy link
Author

Choose a reason for hiding this comment

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

오 이렇게 쓰는 방법도 있군요! 함수 내부에서 사용하는 함수들이 많고 인자값이 많으면 이렇게 쓸수도 있겠네요!! 감사합니다!!

}


if(isEditing){
Copy link
Author

Choose a reason for hiding this comment

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

여기서 if ... else 문을 사용하셔도 되고 삼항 연산자를 사용해서 코드를 짜시는 분들도 꽤 있는것 같습니다. if(isEditing) ? return(에디팅 상태일때) : return(에디팅상태 아닐때(기본상태) 나중에 이 방법도 사용해 보시면 좋을것 같습니다!

@@ -1,10 +1,71 @@

import React, {useState, useCallback} from "react";
Copy link
Author

Choose a reason for hiding this comment

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

경선님은 tailwind css 써보시고 나서 어땠나요??? 제가 생각했을때는 코드를 최초 작성하는 작성자가 작업하기에는 되게 편한 프레임 워크 같은데 만약에 개별 요소에 적용해야될 스타일이 많아질 경우에는 코드 자체의 가독성이 오히려 떨어질수도 있겠다는 생각이 들어서요. 리뷰어의 입장에서는 뭔가 css에 관한 코드는 토글식으로 접을수 있는 기능이 있으면 더 좋지 않을까 라는 생각을 했습니다. 그냥 이것은 개인적으로 써보셨을때 어떠셨는지 의견 주시면 감사하겠습니다.

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.

3 participants