I would like to map the object and get the number/length of replies that can be found in replies in this case 2. I have fetched this data from the API and is unable to get the number of replies that can be found here.
let data = [
{
"feedbackId":32,
"sender":"12345"
"comment":"Test Comment",
"replies":[
{
"feedbackLogId":32,
"feedbackReplyLogId":1,
"comments":"So this is 1",
"createdBy":"Jack",
},
{
"feedbackLogId":32,
"feedbackReplyLogId":2,
"comments":"2nd one",
"createdBy":"Min",
}
],
}
]
This is what I've done. I am only able to get 1 as the length.
let repliesToRender = data.map((item) => {item.replies})
let numReplies = repliesToRender.length