BlazorFocused 1.0.0-alpha1
This is a prerelease version of BlazorFocused.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package BlazorFocused --version 1.0.0-alpha1
NuGet\Install-Package BlazorFocused -Version 1.0.0-alpha1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorFocused" Version="1.0.0-alpha1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorFocused --version 1.0.0-alpha1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: BlazorFocused, 1.0.0-alpha1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorFocused as a Cake Addin #addin nuget:?package=BlazorFocused&version=1.0.0-alpha1&prerelease // Install BlazorFocused as a Cake Tool #tool nuget:?package=BlazorFocused&version=1.0.0-alpha1&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
BlazorFocused
Adding Reactive Programming and Flux Architecture to Blazor Components with Microsoft.Extensions.DependencyInjection
Register
Integrate basic store in Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddRazorPages();
// initialized instance of the store's data
var testClass = new TestClass { FieldOne = "Test" };
// add store in DI
services.AddStore(testClass);
}
Integrate store with reducers in Startup.cs:
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddRazorPages();
// initialized instance of the store's data
var testClass = new TestClass { FieldOne = "Test" };
// add store in DI
serviceCollection.AddStore(testClass, builder =>
{
builder.RegisterReducer(new TestReducer());
});
}
State
Retrieve static state value from store:
@inject IStore<TestClass> store;
...
store.GetState().FieldOne;
Retrieve state value and subscribe to store updates:
@inject IStore<TestClass> store;
...
TestClass 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<TestClass> store;
...
TestClassSubset currentState = default;
store.Reduce<TestClassSubset>(reducedState =>
{
currentState = reducedState;
// inform blazor page to refresh with state update
StateHasChanged();
});
Actions
Register custom actions
public void ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddRazorPages();
// initialized instance of the store's data
var testClass = new TestClass { FieldOne = "Test" };
// add store in DI
serviceCollection.AddStore(testClass, builder =>
{
builder.RegisterAction(new TestAction());
});
}
Execute actions to update store:
@inject IStore<TestClass> store;
...
TestClass currentState = default;
// call action to be committed
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 | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- Microsoft.Extensions.DependencyInjection (>= 5.0.1)
- Microsoft.Extensions.Http (>= 5.0.0)
- Microsoft.Extensions.Logging (>= 5.0.0)
- System.Reactive (>= 5.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 | |
---|---|---|---|
2.3.0 | 365 | 12/11/2022 | |
2.2.2 | 502 | 10/19/2022 | |
2.1.1 | 470 | 6/20/2022 | |
2.1.0 | 470 | 4/20/2022 | |
2.0.0 | 452 | 2/22/2022 | |
2.0.0-preview1 | 176 | 2/18/2022 | |
2.0.0-beta2 | 153 | 2/11/2022 | |
2.0.0-alpha2 | 168 | 2/10/2022 | |
2.0.0-alpha1 | 179 | 2/3/2022 | |
1.2.2 | 378 | 8/25/2021 | |
1.2.1 | 322 | 8/24/2021 | |
1.2.0 | 344 | 8/22/2021 | |
1.1.2 | 416 | 7/16/2021 | |
1.1.1 | 358 | 3/27/2021 | |
1.1.0 | 331 | 3/27/2021 | |
1.0.1 | 329 | 2/19/2021 | |
1.0.0 | 355 | 2/15/2021 | |
1.0.0-beta1 | 316 | 1/17/2021 | |
1.0.0-alpha2 | 231 | 1/16/2021 | |
1.0.0-alpha1 | 277 | 1/12/2021 |
Initial library submission