let renderReplyComment=(parentCommentId)=>{
for (let i=0;i<8;i++){
if (props.commentLists[i].responseTo === parentCommentId){
console.log(props.commentLists[i].content)
}
}
props.commentLists.map((comment,index)=>(
(comment.responseTo === parentCommentId &&
<React.Fragment>
<div style={{ width: '80%', marginLeft: '40px' }}>
<SingleComment comment={comment} postId={props.videoId} refreshFunction={props.refreshFunction} />
<ReplyComment CommentLists={props.CommentLists} parentCommentId={comment._id} postId={props.videoId} refreshFunction={props.refreshFunction} />
</div>
</React.Fragment>
)
))
ReplyComment.js 코드 안에서서 대댓글을 생성하는 코드입니다.
위 함수에 아예 못 들어가는건가 싶어서 안에 for문으로 responseTo와 parentCommentID가 같을 경우 content log를 찍어봤는데 정확히 잘 나오는걸 확인했습니다.
그런데 대댓글 생성은 안됩니다.
아래가 제 실행 결과이고 그냥 댓글 생성은 되는것으로 보아 singleComment.js 파일은 문제가 없는거 같은데
대댓글이 생성 안 되는 이유를 모르겠습니다.