Getting rid of viewmodels as a parameter from Screens #123
atimadanoglu
started this conversation in
General
Replies: 1 comment 1 reply
-
I think that's a better approach and we should go for it! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think we should get rid of viewmodels as a parameter from Screen level. We should inject viewModels on Route level because when we try to preview the composables, it troubles us. Also, it creates other different problems.
From Documentation: https://developer.android.com/jetpack/compose/tooling/previews#preview-viewmodel
Warning: You shouldn't pass the ViewModel instances down to other composable functions. When you do this, you're coupling the composables with the ViewModel type, which makes them less reusable, harder to test, and unable to preview.
What do you think about that?
Beta Was this translation helpful? Give feedback.
All reactions