What is the correct way to obtain and passdown fun...
# compose
v
What is the correct way to obtain and passdown function calls (in this case the navController in navigateToScanScreen) in the following setup?
Copy code
@Composable
fun MyNavHost(navController: NavHostController) {
    val owner = checkNotNull(LocalViewModelStoreOwner.current)
    NavHost(navController = navController, startDestination = Login) {
        homeScreenGraph()
        loginScreenGraph(owner)

    }
}
Copy code
fun NavGraphBuilder.homeScreenGraph() {
    composable<Home> {
        HomeScreen(
            navigateToScanScreen = //how should I obtain the navController here?
        )
    }
}


@Serializable
object Home
s
Have your homeScreenGraph take in a
onNavigateToScanScreen: () -> Unit
Then call it like
homeScreenGraph(onNavigateToScanScreen = { navController.navigate(ScanScreen) })