Hello, everyone!
I’m having some issues with ViewModel + Hilt + Navigation. I already took a look at
previous discussions but I need some advice.
I have a
Home
screen that contains 4 tabs, each one with its own
ViewModel
.
Today it is declared this way:
composable(Destinations.Home) {
Home(
onTaskClicked = actions.openTaskDetail,
onAboutClicked = actions.openAbout
)
}
But since calling
viewModel()
to get the ViewModels for each Composable does not work, how should I proceed? Get the 4 ViewModels inside my
NavGraph
and pass then all to my
Home
? Should I create a
HomeViewModelProvider
containing the 4 ViewModels? Is there a better approach?
Thanks a lot in advance! ❤️