Navigation 3 supports nested navigation graphs and shared ViewModels through nested NavDisplay components. By creating a hierarchy of navigation graphs (e.g., auth and todo features), you can scope ViewModels to entire feature sets rather than individual screens. The key is initializing shared ViewModels outside specific screen entries but within the feature's NavDisplay, allowing state to persist across multiple screens until the entire feature graph is removed from the backstack. Each feature maintains its own backstack while a root backstack handles navigation between features.

35m watch time

Sort: