Join Slack
Powered by
Has anyone seen an example of how should viewmodel...
# compose
u
ursus
09/03/2021, 12:45 PM
Has anyone seen an example of how should viewmodel+compose work with dagger? probably to provide the Screen composable woth viewmodel injected somehow?
c
Csaba Szugyiczki
09/03/2021, 12:49 PM
There is official support from jetpack to inject viewmodels into Composables:
https://developer.android.com/jetpack/compose/libraries#viewmodel
Csaba Szugyiczki
09/03/2021, 12:50 PM
To tie it together with dagger, I think the easiest way is to use hilt:
https://developer.android.com/training/dependency-injection/hilt-jetpack#compose
u
ursus
09/03/2021, 12:54 PM
thanks!
3
Views
Open in Slack
Previous
Next