Does anyone knows why my ViewModel always restart ...
# compose
r
Does anyone knows why my ViewModel always restart my
var image by mutableStateOf
value every time I get the viewmodel (
val viewModel = getViewModel<MainViewModel>()
) in a composable function? I'm using koin to inject it.
Also I realised that my viewmodel always executive the
init{}
when I get it in a
@Composable
v
maybe recomposing doing that
r
yeah, I think I should pass a parameter to the
@Composable
and then, when I get the viewmodel refresh my data
v
yes, pass viewmodel in params
g
Looks that you need
remember