I don't think passing the NavControllers down to compose tree is a good practice.
1. Encourages Coupling:
- Using CompositionLocal for NavController can tightly couple your composables to the navigation implementation.
- This makes testing and reuse harder because the composables assume the presence of a NavController.
2. Lifecycle Mismatch: NavController is tied to the lifecycle of a NavHost and the activity/fragment it resides in. Providing it via CompositionLocal risks introducing lifecycle mismatches or unintended behaviors.
...
I think you should check android documents deeper: https://developer.android.com/develop/ui/compose/compositionlocal