Blazor WebAssembly Lazy loading

Tram Ho

Development Environment: .NET SDK 5.0.100-rc.2.20479.15 , Microsoft Visual Studio Community 2019 Preview – Version 16.8.0 Preview 5.0 . Windows 10 x64 version 2004, Google Chrome Version 86.0.4240.111 (Official Build) (64-bit) or Micrsoft Edge Version 86.0.622.51 (Official build) (64-bit). Create a new project

Name the library project (Class libarary – .NET Standard) as CounterAssembly . Select the supported version as .NET 5

File CounterHelper.cs

Build class libarary project. Then add references

Add this line to _Import.razor

The entire content of the _Import.razor file becomes

The App.razor file has an original content

App.razor file adds lines of code using Lazy loading, becomes

Find the file SundayOct.Client.csproj , the initial content is

Add more content

to become

Build all Solution, run debug again

Source code: https://github.com/donhuvy/blazor_webassembly_lazyload

Share the news now

Source : Viblo