Blazor¶
ReactiveUI.Blazor connects ReactiveUI to Blazor. Add it by following
Installation. ReactiveUI.Blazor also ships as
ReactiveUI.Blazor.Reactive, built from the same source, for an app that uses System.Reactive. See
Blazor for a full walkthrough, built around a to-do list.
Guidelines¶
- View models inherit from
ReactiveObject, or fromReactiveValidationObjectwhen a view model needs validation. - Pick the component base class by how the view model reaches the page.
ReactiveComponentBase<T>takes its view model as a component parameter or lets the page instantiate one directly.ReactiveInjectableComponentBase<T>resolves its view model from the dependency injection container instead.ReactiveLayoutComponentBase<T>gives the same shape to a layout that wraps other pages.ReactiveOwningComponentBase<T>also owns a scoped service provider, disposed with the component, for a view model that needs a scoped dependency. - Use
IActivatableViewModelandWhenActivatedfor lifecycle. See When Activated. - Keep every subscription disposed. See Cleaning up subscriptions and Disposables.