Using Compose in Views | Jetpack Compose | Android Developers ComposeView in Fragments If you want to incorporate Compose UI content in a fragment or an existing View layout, use ComposeView and call its setContent() method ComposeView is an Android View You can put the ComposeView in your XML layout just like any other View:
How to use Android View inside Jetpack Compose and vice versa? Use the AndroidViewBinding composable to add a Fragment in Compose AndroidViewBinding has fragment-specific handling such as removing the fragment when the composable leaves the composition
Creating instance of ViewModel in screen composable We are doing it to make the composable completely independent of a ViewModel Your "new" approach (putting the ViewModel initialization logic inside the composable) doesn't solve the three example issues I've listed
Share ViewModel in Jetpack Compose NavGraph: A Koin Guide For sharing ViewModels across a navigation graph, you generally have two main approaches: Using koinNavViewModel () (Koin 3 1 3 and above) This is the most straightforward and recommended way provided by Koin specifically for Compose Navigation