Join Slack
Powered by
hey folks, what is the best "compose" way of calli...
# compose
i
Ian Warwick
02/15/2021, 12:17 PM
hey folks, what is the best "compose" way of calling suspended functions to return data for display, should I still use the
ViewModel
approach or is there a better way that still has the same benefits (such as surviving state changes) of using VM approach?
c
Cyril Find
02/15/2021, 1:22 PM
you can keep doing almost like classic android MVVM where you call suspend funs in
viewModelScope
n
Neil
02/15/2021, 2:18 PM
Yeah set up the ViewModel as normal and then use observeAsState
https://developer.android.com/jetpack/compose/state#viewmodel-and-jetpack-compose
➕ 2
Open in Slack
Previous
Next