목록유튜브 댓글기능 (2)
For Programmer

* 위 구조에서 볼 수 있듯이 ReplyComment안에 있는 SingleComment 와 ReplyComment를 중첩시켜놓는 구조를 만들어야한다. 1.Comment.js에서 큰 틀 잡기위한 코딩 {/* Comment Lists */} {props.commentList && props.commentList.map( (comment, index) => !comment.responseTo && ( //대댓글은 우선 숨기겠다는 의미 ) )} {/* Root Comment Form */} ...이하생략 * 각각의 코멘트 마다 map메서드를 통해서 댓글내용을표시하고(SingleComment) 그 밑에 대댓글의 개수를 구하는 형태(ReplyComment)를 만들겠다는 코드 (단 !comment.reponseTo ..

1.댓글구조 2.Comment model 생성(server-models-Comment.js) const mongoose = require("mongoose"); const Schema = mongoose.Schema; const commentSchema = mongoose.Schema( { writer: { type: Schema.Types.ObjectId, ref: "User", }, postId: { type: Schema.Types.ObjectId, ref: "Video", }, responseTo: { type: Schema.Types.ObjectId, ref: "User", }, content: { type: String, }, }, { timestamps: true } ); const Comm..