reactiveViewModel
inline fun <VM : CoroutineLauncher> reactiveViewModel( key: String? = null, crossinline onError: (Throwable) -> Unit, crossinline provider: ReactiveStateContext.() -> VM): State<VM>
Creates a multiplatform ViewModel. The provider should instantiate the object directly.
You have to pass loading and error effect handlers, so the most basic functionality is taken care of.
Instead of returning the raw ViewModel this returns a Compose State object containing the ViewModel. This way the UI can keep up to date with a dynamically changing dependency injection graph. If the ViewModel depends on a DI object it gets destroyed and re-created whenever that DI module is replaced.