Hello. I was wondering. I have an existing application that uses an MVU architecture and I wanted to look if I can move it to compose-web as a test. So we have an immutable model, a view and update routine. I can easily replace the View with a composeable architecture. The Model will become MutableState<Model> here and the updates will happen via the event handlers which trigger some model update.
My question is, will this be performant? As long as I break down my view into composables with arguments they should only recompose when their arguments have changed right? So if I pass down the model elements down to the composables, everything should just be working correctly and 'pretty optimal'?
Thanks, I had another question though. I am experimenting with something and I noticed that this works as well:
Copy code
class MyContext(initialModel: Model) {
var model by mutableStateOf(initialModel)
private set
}
fun main() {
with (MyContext(initialize()) {
renderComposable("root") {
// some composable which directly reference model
}
}
}
Arjan van Wieringen
05/03/2022, 8:50 AM
So, the composables directly reference
model
so no arguments are passed. However, they recompose brilliantly. Is this all handled by the delegation?