DEV Community

Discussion on: A historical introduction to the Compose reactive state model

Collapse
 
aartikov profile image
Artur Artikov

Should we use mutableStateOf in ViewModels? Official documentation recommends to use LiveData or StateFlow for some reason: developer.android.com/jetpack/comp...

Collapse
 
zachklipp profile image
Zach Klippenstein

It depends how much you want to couple your ViewModels to the Compose runtime and mental model. I do wish the snapshot stuff was in a separate artifact so this would be an easier call. I would see no reason to not use snapshot state in view models in a 100% compose app. I also think that in such an app, "view model" is basically interchangeable with/just another word for "hoisted state class".