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

Hasan Nagizade

01/08/2023, 6:53 PM
if I will initialize ViewModel like this will this ViewModel get deleted once I navigate to other composable?
f

Francesc

01/08/2023, 8:35 PM
As long as the screen for this composable is in the backstack the viewmodel will be kept alive. Once you pop the screen the viewmodel will be destroyed
z

Zun

01/08/2023, 8:52 PM
You can prove this yourself by logging inside the unit or placing a breakpoint there
6 Views