we’ve the dropdown list fetched from a backend ser...
# compose
m
we’ve the dropdown list fetched from a backend services, any suggestion how to update/observe the data? our current approach:
Copy code
// 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