M
M
Macan2022-02-10 15:52:18
JavaScript
Macan, 2022-02-10 15:52:18

How to properly implement nested comments?

Hello everyone, I have a question about building nested comments. What is the best way to implement this? The following JSON comes from the back:

[
     {
      "commentText": "Это родитель",
      "pageID": 1,
      "userID": 1,
      "date": "2021-12-25 14:00:00",
      "path": "000000001",
      "dateModified": "2021-12-25 14:00:00",
      "isDelete": "False",
      "isPrivate": "False",
      "attachment": []
    },
    {
      "commentText": "Это первый потомок",
      "pageID": 1,
      "userID": 2,
      "date": "2021-12-25 14:10:00",
      "path": "000000001000000002",
      "dateModified": "2021-12-25 14:10:00",
      "isDelete": "False",
      "isPrivate": "False",
      "attachment": []
    },
    {
      "commentText": "Это второй потомок",
      "pageID": 1,
      "userID": 3,
      "date": "2021-12-25 14:15:00",
      "path": "000000001000000003",
      "dateModified": "2021-12-25 14:15:00",
      "isDelete": "False",
      "isPrivate": "False",
      "attachment": []
    },
    {
      "commentText": "Это третий потомок",
      "pageID": 1,
      "userID": 4,
      "date": "2021-12-25 14:20:00",
      "path": "000000001000000002000000003",
      "dateModified": "2021-12-25 14:20:00",
      "isDelete": "False",
      "isPrivate": "False",
      "attachment": []
    },
    {
      "commentText": "Это четвертый потомок",
      "pageID": 1,
      "userID": 1,
      "date": "2021-12-25 14:12:00",
      "path": "000000001000000003000000004",
      "dateModified": "2021-12-25 14:12:00",
      "isDelete": "False",
      "isPrivate": "False",
      "attachment": []
    }
 ]

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question