What is considered the best way to connect a ViewM...
# compose
m
What is considered the best way to connect a ViewModel to a Composable? Using a "mutable"
StateFlow
or
LiveData
that is "collected as state" and receive new values directly (e.g.,
onChanged = { vm.stateFlow.value = it }
or creating a "local remembered state" and passing it back only when necessary (e.g.,
onClick = { vm.onClick(myRememberedState.value) }
). 🤔
âž• 2
n
hi @Marcello Galhardo 👋 In my last presentation I suggested to pass the VM as parameter… Not sure if it’s the “good practice”, but sounds more easy to me at first glance… https://www2.slideshare.net/nglauber/jetpack-compose-a-new-way-to-implement-ui-on-android/62
👍 1
n