BlazorFocused.Reactive.Redux
1.0.0
dotnet add package BlazorFocused.Reactive.Redux --version 1.0.0
NuGet\Install-Package BlazorFocused.Reactive.Redux -Version 1.0.0
<PackageReference Include="BlazorFocused.Reactive.Redux" Version="1.0.0" />
paket add BlazorFocused.Reactive.Redux --version 1.0.0
#r "nuget: BlazorFocused.Reactive.Redux, 1.0.0"
// Install BlazorFocused.Reactive.Redux as a Cake Addin #addin nuget:?package=BlazorFocused.Reactive.Redux&version=1.0.0 // Install BlazorFocused.Reactive.Redux as a Cake Tool #tool nuget:?package=BlazorFocused.Reactive.Redux&version=1.0.0
BlazorFocused Reactive Redux
Provides one single source of updating and retrieving a data store throughout entire application
NuGet Packages
Package | Description |
---|---|
BlazorFocused.Reactive.Redux | Provides one single source of updating and retrieving a data store throughout entire application |
Documentation
Please visit the BlazorFocused.Reactive Documentation Site for installation, getting started, and API documentation.
Samples
Please visit and/or download our BlazorFocused.Reactive.Redux Sample Solution to get a more in-depth view of usage.
Installation
dotnet add package BlazorFocused.Reactive.Redux
Quick Start
Blazor WebAssembly Startup
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.Services.AddScoped(sp =>
new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
builder.Services.AddStore<TestStore>(new TestStore { FieldOne = "Initialized" })
.AddTransient<TestAction>()
.AddTransient<TestActionAsync>()
.AddTransient<TestReducer>()
.AddScoped<TestService>()
.AddSingleton<TestSingletonService>();
await builder.Build().RunAsync();
}
State
Retrieve static state value from store:
@inject IStore<TestStore> store;
...
store.GetState().FieldOne;
Retrieve state value and subscribe to store updates:
@inject IStore<TestStore> store;
...
TestStore currentState = default;
store.Subscribe((newState) => {
// update state used in page
currentState = newState;
// inform blazor page to refresh with state update
StateHasChanged();
});
Reducers
Subscribe to reduced value from store:
@inject IStore<TestStore> store;
...
TestStoreSubset subsetState = default;
store.Reduce<TestReducer, TestStoreSubset>(reducedState =>
{
// helpful if you do not care about the full state in your component
subsetState = reducedState;
// inform blazor page to refresh with state update
StateHasChanged();
});
Actions
Execute actions to update store:
@inject IStore<TestStore> store;
...
TestStore currentState = default;
// call action to be committed
// if action updates state, component will update
store.Dispatch<TestAction>();
store.Subscribe((newState) => {
// update state used in page
currentState = newState;
// inform blazor page to refresh with state update
StateHasChanged();
});
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.DependencyInjection (>= 6.0.1)
- Microsoft.Extensions.Logging (>= 6.0.0)
- System.Reactive (>= 6.0.0)
-
net7.0
- Microsoft.Extensions.DependencyInjection (>= 7.0.0)
- Microsoft.Extensions.Logging (>= 7.0.0)
- System.Reactive (>= 6.0.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection (>= 8.0.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
- System.Reactive (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 123 | 2/27/2024 |
1.0.0-alpha1 | 82 | 9/29/2023 |