• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

댓글은 생성이 되는데 대댓글 생성이 안 됩니다

21.03.01 21:27 작성 조회수 207

0

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 파일은 문제가 없는거 같은데

대댓글이 생성 안 되는 이유를 모르겠습니다.

답변 0

답변을 작성해보세요.

답변을 기다리고 있는 질문이에요.
첫번째 답변을 남겨보세요!