at the moment i am doing: ``` @Composable priva...
# koin
m
at the moment i am doing:
Copy code
@Composable
  private fun configureNavigation() {
    val navController = rememberNavController()
    loadKoinModules(module { single<NavController> { navController } })
  }
This has the disadvantage that i have to actively unload the module when the Activity is destroyed.
g
Why do you need to load it into a module and provide it as singleton?
rememberNavController
should be enough. Internally it uses compose's
remember
https://developer.android.com/jetpack/compose/navigation#getting-started
m
That is correct but you have to use composable functions inside another composable function.
so you can not use remberNavController() in your module declaration
g
Yeah but my question is why do you need to do that?
You should create the 
NavController
 in the place in your composable hierarchy where all composables that need to reference it have access to it.
From the link I've sent. I don't think there is a reason to injected with Koin. You can pass it as a method argument
m
That is correct as well. In some cases you might need to be pass it pretty far down the compose node chain.
another option could be to make it a Compose ambient