Implementing Redux pattern in Blazor WebAssembly using .NET 8 and Fluxor. You can also find the related YouTube video here.
- .NET 8 SDK (8.0.1)
- (Optional) Redux DevTools Chrome extension. Very handy to debug action dispatches and state changes.
- Clone this repository
git clone https://github.com/christoment/BlazorWithRedux
- Restore dependencies using
dotnet restore
- Run Blazor WebAssembly in watch mode.
dotnet watch run
- Your default browser should automatically opened for you. Navigate to the Counter page to see the example.
As per Fluxor v5.4.0, Fluxor requires the following additional setup:
- Store initialiser + DOM for the ReduxDevTool to look for in
App.razor
:<Fluxor.Blazor.Web.StoreInitializer/>
- Fluxor initialisation in
Program.cs
builder.Services.AddFluxor(options => { options .ScanAssemblies(typeof(Program).Assembly) .UseReduxDevTools(); });