Inflearn Community Q&A
또.. 질문입니다 ㅎㅎㅎㅎ...
Written on
·
235
0
질문이 많아서 죄송하네요 ㅠ.ㅠ
코멘트를 랜더하는 코드에서
중괄호를 써서 함수를 만들면 (두번째 코드)
랜더가 안되더라구요
중괄호가 들어가는 것과 들어가지 않은것이 무슨 차이가 있는지 궁금합니다
궁금한게 많은것 같아서 죄송하네요 ㅠ.ㅠ.
let renderReplyComment = (parentCommentId) =>
props.commentLists.map((comment, index) => (
<React.Fragment>
{comment.responseTo === parentCommentId && (
<div style={{ width: "80%", marginLeft: "40px" }}>
<SingleComment
key={index}
refreshFunction={props.refreshFunction}
comment={comment}
postId={props.postId}
/>
<ReplyComment
parentCommentId={comment._id}
refreshFunction={props.refreshFunction}
postId={props.postId}
commentLists={props.commentLists}
/>
</div>
)}
</React.Fragment>
));
=====================================================
let renderReplyComment = (parentCommentId) => {
props.commentLists.map((comment, index) => (
<React.Fragment>
{comment.responseTo === parentCommentId && (
<div style={{ width: "80%", marginLeft: "40px" }}>
<SingleComment
key={index}
refreshFunction={props.refreshFunction}
comment={comment}
postId={props.postId}
/>
<ReplyComment
parentCommentId={comment._id}
refreshFunction={props.refreshFunction}
postId={props.postId}
commentLists={props.commentLists}
/>
</div>
)}
</React.Fragment>
));
};
reactmongodbreduxnodejs
Answer 2
1
John Ahn
Instructor
안녕하세요 릴롱궤님 ㅎㅎㅎ
친구가 된것 같네요 ㅎ
중괄호를 하면 return 으로 표현해줄부분을 출력해주셔야 화면에 보이게 되고
아니면 지금처럼 아예 중괄호를 없애 주시거나 () 이걸로 감싸주셔도 됩니다 ^^
0





