Scoping ViewModels in Compose
Lifecycle ViewModel 2.11.0-alpha02 introduces rememberViewModelStoreOwner, an API to scope ViewModelStore directly within the Compose hierarchy. Why It Matters Until now, ViewModelStore scoping was tied to navigation destinations, activities or fragments. There was no clean way to scope a ViewModel to an arbitrary part of your UI (such as a Pager page, a LazyList item, or a custom layout) without building your own ViewModelStoreOwner from scratch. These new APIs close that gap:...