miqbaldc
04/29/2021, 9:33 AM// Activity.kt
private val list by mutablesStateOf<List<String>>(emptyList())
// onCreate
setContent {
DropdownList(list = list)
}
viewModel.fetchList() // fetch data from backend services
viewModel.observe(this) {
// updating the list
list.value = it
}
We’ve also read the Recomposition of viewmodel observation from an official docs, is this recommended using the above approach?
Looks like it’s the anti-pattern, cmiiw 🙏
Our dropdown (spinner) is inspired from here