DEV Community

Sett Yan Naung
Sett Yan Naung

Posted on • Edited on

test

         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
         );
Enter fullscreen mode Exit fullscreen mode

fdhdsgfhfgdh

hgjfgjfgj

sdfad

Top comments (0)