Hi, is `Jetpack Compose` aware of configuration ch...
# android
l
Hi, is
Jetpack Compose
aware of configuration changes or should we still use
AAC ViewModel
for this purpose?
a
Hi! We're over in #compose if you'd like to join us there. If you mean to ask whether compose state is retained across activity recreation, there are the savedInstanceState functions but the non-parcelable variants aren't there yet. They'll be coming before long, but no immediate ETA. AAC ViewModel will work just fine until then.
l
Ahh nice thank you, I will join
So did I understand right, that AAC ViewModel will be replaced by these savedInstanceState functions when they are available?
a
The savedInstanceState functions are already there in compose, those handle cold process restart cases. The activity recreation in a live process case is the intermediate case that compose doesn't have API for yet.
l
Sure thats what I mean, my bad. But ViewModel's existence is still justified right? I have a lot of business logic within my Composable functions. Is it encouraged to move such code to a ViewModel or whats the best practice for handling business logic with compose?