Hi I want to render the comments of my applications as comments and its reply's but I dont have idea on how to do it with my data:
My data looks like:
"comments": [
{
"id": "30",
"content": "Comment 1",
"parent": "0",
},
{
"id": "31",
"content": "Comment 2",
"parent": "0",
},
{
"id": "32",
"content": "comment 3",
"parent": "0",
},
{
"id": "33",
"content": "sub comment 1-1",
"parent": "30",
},
{
"id": "34",
"content": "sub comment 2-1",
"parent": "31",
},
{
"id": "35",
"content": "sub sub comment 1-1-1",
"parent": "33",
},
{
"id": "36",
"content": "sub comment 1-2",
"parent": "30",
}
]
where parent
refers to the id of the comment that reply, so it shoold be shown like:
Comment 1
sub comment 1-1
sub sub comment 1-1-1
sub comment 1-2
Comment 2
sub comment 2-1
Comment 3
but until now i only have a list in the order of my data