https://kotlinlang.org logo
#compose
Title
# compose
m

Marko Novakovic

01/29/2021, 1:14 PM
ViewModel
as it is, for surviving configuration change isn’t really needed in
Compose
. Right?
Compose
has it’s own
by saveInstanceState
. do we still use
ViewModel
as we have been using it until now?
d

Dominaezzz

01/29/2021, 1:16 PM
Yup you don't need it for surviving configuration changes. (Other uses still remain though.)
m

Marko Novakovic

01/29/2021, 1:16 PM
sure, thanks
n

nrobi

01/29/2021, 1:22 PM
But you still need to make the VM parcelable or some sort, because of how
saveInstanceState
works, no?
j

Joost Klitsie

01/29/2021, 2:46 PM
you don't have to make the whole VM parcelable, you only need to save the state somehow
n

nrobi

01/29/2021, 3:37 PM
Yeah, but still IMO doesn't scale as well 🤔
i

Ian Lake

01/29/2021, 3:48 PM
Saved instance state is tiny amounts of data (think, the key of a selected item). That's a totally different use case than what non-config state and ViewModels are for (caching the list of data from your repository layer so that it is instantly available to your UI after a config change)
👌 2
👍 1