modifiedComments = comments.map((comment) =>
comment.commentId === commentId ||
Object.values(comment.replies).find(
(cmt) => cmt.commentId === commentId
)
? {
...comment,
replies: {
...comment.replies,
[nanoid()]: {
...newComment,
repliedUserId,
repliedCommentId: commentId,
},
},
}
: comment
);
fdhdsgfhfgdh
hgjfgjfgj
Top comments (0)