I have a data class like this: ```data class Categ...
# compose
a
I have a data class like this:
Copy code
data class Category (
    val title: String,
    val items: List<String>
)
And I want to display a list of
Category
using a LazyColumn. I tried this:
Copy code
LazyColumn {
    items(list) { category ->
        Text(text = category.title)
        category.items.forEach { item ->
            Text(text = item)
        }
    }
}
But I want to replace the inner loop with something lazy. I can't nest another LazyColumn. Using
this@LazyColumn.items(category.items)
doesn't give the desired UI. How to implement this case?
a
Copy code
LazyColumn {
    list.forEach { category ->
        item {
            Text(text = category.title)
        }
        items(category.items) { item ->
            Text(text = item)
        }
    }
}
a
It worked. Thanks !!!
👍 1