질문이 많아서 죄송하네요 ㅠ.ㅠ
코멘트를 랜더하는 코드에서
중괄호를 써서 함수를 만들면 (두번째 코드)
랜더가 안되더라구요
중괄호가 들어가는 것과 들어가지 않은것이 무슨 차이가 있는지 궁금합니다
궁금한게 많은것 같아서 죄송하네요 ㅠ.ㅠ.
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>
));
};