I don’t see a separate channel for decompose, so I...
# compose
l
I don’t see a separate channel for decompose, so I’ll ask my question here: I have a Component that has several instances of the same sub-component, which will get rendered in a Column. Each one has fairly complex logic and is independent from the others, so I’m thinking one Component class, and an array of instances. I can see here that I should use childComponent with a unique key. Is there a good way to create an array of childComponent built in, or should I have the keys be Bar0, Bar1, Bar2, etc?
x
its about time we have a seperate channel for decompose @Arkadii Ivanov 😅
❤️ 1
a
Yeah, there is no channel. Some people are using #mvikotlin for this. But I will think about a separate channel. As mentioned in the docs, there are two ways of creating child components - via
Router
and manually. In the latter case, they should have unique keys. So something like this should work (off the top of my head):
Copy code
val children = List(10) { index ->
    MyComponent(
        context = childContext(key = "Child$index"),
        // Other dependencies here
    )
 }
I have requested the channel creation, hopefully we'll have it - https://kotlinlang.slack.com/archives/C0B8W32VA/p1652999626400209
🙌 1
🎉 1
The channel is created - #decompose . Everyone is welcome!
🙌 1