Im new in alpineJS. I read official documentation and google, but I have not found any answer to the question: how to loop through nested array? Example:
<body>
<div x-data="comments()">
<template x-for="i in commentsList">
<p x-text="i.text"></p>
<template x-for="reply in i.replies">
<p x-text="reply.text"></p>
</template>
</template>
</div>
</body>
<script>
const comments = () => {
return {
commentsList: [
{
"createdAt": "20.01",
"text": "Hello all how can i use double cycle in alpinejs?",
"replies": [
{
"createdAt": "21.01",
"text": "I dont know?"
},
{
"createdAt": "22.01",
"text": "What is written in official doc?"
}
]
},
{
"createdAt": "23.01",
"text": "How to show replies?",
"replies": [
{
"createdAt": "24.01",
"text": "It is not possible right now"
}
]
},
]
}
}
</script>
I read official documentation and used google. I need to get the answer to question, because I have not found it.