Re: Compose Navigation Is there any sane/preferre...
# compose
e
Re: Compose Navigation Is there any sane/preferred way to create the NavHostController outside of compose, but still be able to setup your navhost using it? In my use case I’m thinking of injecting a nav controller into my VMs, since they are responsible for taking actions on my navigation events (at least in my current arch).
The Architecting your Compose UI talks about treating events as state: https://developer.android.com/jetpack/compose/architecture#example
and the Guide to App Architecture has a whole page on UI events, with a special section specifically on events from a ViewModel: https://developer.android.com/jetpack/guide/ui-layer/events#handle-viewmodel-events
e
It looks like the suggestion is what we’re currently doing, but thanks for the reference as it underlines what I thought.