Implementing Redux pattern in Blazor WebAssembly using C#9 and Fluxor on .NET 5 (video).
- Install .NET 5 https://dotnet.microsoft.com/download/dotnet/5.0
- 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.
Fluxor needs the following dependencies added:
- Javascript file in
index.html
<script src="_content/Fluxor.Blazor.Web/scripts/index.js"></script>
- Store initialiser + DOM for the ReduxDevTool to look for:
<Fluxor.Blazor.Web.StoreInitializer/>
- Fluxor initialisation in
Program.cs
public class Program { public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.Services.AddFluxor(options => { options .ScanAssemblies(typeof(Program).Assembly) .UseReduxDevTools(); // For ReduxDevTool support. Recommended to remove this on Production }); // ... } }