How do I pass values from one page to another in Blazor WebAssembly?

By using Blazor route parameters, you can pass values from one page to another page. Use NavigationManager to pass a value and route the parameter to another page. Follow this example to achieve passing values from one page to another.[Page1.razor] Get the passed Page1 parameter value in Page2.[Page2.razor] Refer to this link for more details.

How do I make two-way binding in Blazor?

In two-way binding, data moves from the component to the UI and from the UI to the component class. Use the @bind attribute in the property to bind two ways in Blazor. By default, the bind attribute binds the data in the OnChange event. The OnChange event triggers when the element loses focus. Follow these steps to achieve the two-way binding in Blazor. Refer to this link for more details.

How do I dispose a page in Blazor WebAssembly?

The Dispose method is used to avoid memory leaks and allows proper garbage collection. Implement the IDisposable interface in the component and call the Dispose method. If the framework calls the Dispose method, the component is removed from the UI and unmanaged resources can be released. The following example demonstrates the disposal of Timer in the counter page. [Counter.Razor] View Sample in GitHub

How do I create a Blazor WebAssembly PWA to work offline?

A progressive web application (PWA) is usually a single-page application (SPA) used to create a Blazor WebAssembly application to work offline. It runs in its own app window and independent of network speed. Follow these steps to create a Blazor WebAssembly PWA application to work offline. Create a Blazor WebAssembly application with a progressive web application configuration. Press Ctrl + F5 to run the application. Users have the option of installing the app. Once the app is installed, the app appears in its own window without an address bar. To run the application offline: Publish the app using this documentation – https://learn.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app?view=aspnetcore-7.0&tabs=visual-studio Deploy the app to a server that supports HTTPS and access the app in a browser at its secure HTTPS address. Run the deployed application in the browser and open the browser’s dev tools. Open the network tab in the browser dev tool and set the throttle setting to offline mode. Refresh the application. It still loads in offline mode, also.