Project
Ensure that you install ReactiveUI.Blazor
into your application.
ViewModel
Your ViewModel should inherit from ReactiveObject
Use IActivatableViewModel
and WhenActivated
for lifecycle
Keep references to your subscriptions
Use disposables to manage lifetime, scope and resources:
View
Your Page (View) should inherit from
- ReactiveComponentBase
: If you want to instantiate your ViewModel corresponding to the View, then set the ViewModel property in the Page's code behind. - ReactiveInjectableComponentBase
: If you want that your corresponding ViewModel should be injected by the dependency injection container. - ReactiveLayoutComponentBase:
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