title: How to acess NavHostController from nested composable Jetpack Compose
body: <p>Assume that my application looks like this</p>
  <pre><code>@Composable
  fun AppNavigation() {
      val navController = rememberNavController()
  
      NavHost(navController, startDestination = Route.Home.route) {
          /// other composes
          composable(&quot;Home&quot;) { HomeCompose(navController) }
      }
  }
  
  @Composable
  fun HomeCompose(navController: NavHostController) {
      ChildCompose(navController)
  }
  
  @Composable
  fun ChildCompose(navController: NavHostController) {
      navController.navigate(&quot;&quot;)
  }
  </code></pre>
  <p>I want to access navController in nested composable to navigate
  but I dont want to pass navController from parent composable to child compsable as above</p>
  <p>Is there anyway to access navController from anywhere inside NavHost without passing it through composable hierarchy</p>
  <p>Edit: for now, I can use CompositionLocalProvider to access navController in nested compose as below</p>
  <pre><code>val AppNavController = compositionLocalOf&lt;NavHostController&gt;() { error(&quot;NavHostController error&quot;) }
  
  @Composable
  fun AppNavigation() {
      val navController = rememberNavController()
      CompositionLocalProvider(
          AppNavController provides navController
      ) {
          NavHost(navController, startDestination = Route.Home.route) {
              /// other composes
              composable(&quot;Home&quot;) { HomeCompose() }
          }
      }
  }
  
  @Composable
  fun HomeCompose() {
      ChildCompose()
  }
  
  @Composable
  fun ChildCompose(navController: NavHostController) {
      val navController = AppNavController.current
      Column(modifier = Modifier.clickable {
          navController.navigate(&quot;Content&quot;)
      }) {
          ...
      }
  }
  </code></pre>