Blazor¶
Project¶
Ensure that you install ReactiveUI.Blazor into your application.
ViewModel¶
Your ViewModel should inherit from ReactiveObject or 'ReactiveValidationObject' if you wish to use ReactiveUI.Validation
ReactiveObjectReactiveValidationObject
Use IActivatableViewModel and WhenActivated for lifecycle
IActivatableViewModel- When Activated
Keep references to your subscriptions
Use disposables to manage lifetime, scope and resources:
View¶
Your Page (View) should inherit from
ReactiveComponentBase<T>: If you want to pass your ViewModel to the page as a parameter or you want to instantiate it to the View, then set the ViewModel property in the Page's code behind.ReactiveInjectableComponentBase<T>: If you want that your corresponding ViewModel should be injected by the dependency injection container.ReactiveLayoutComponentBase: If you only want to instantiate your ViewModel corresponding to the View, then just set the ViewModel property in the Page's code behind.
Use your normal Blazor concepts that you would usually use in Blazor development. There's also some extension methods which will make your life easier
Useful links