How can we attach ViewModel to specific composable...
# compose
r
How can we attach ViewModel to specific composable using Hilt? VM should be removed when that composable screen is remvoed.
c
The docs go over this https://developer.android.com/jetpack/compose/libraries#hilt Is there anything specific you need help with? Basically if you use hilt + VM + compose navigation you will get VM scoped to a destination.
👍 1
i
You can't scope ViewModels to Composables - see https://issuetracker.google.com/issues/165642391
The only per screen style scoping of ViewModels comes when using Navigation Compose
👍 1