Creating the local storage service
The LocalStorage
project will be created by using the Empty Blazor WebAssembly App project template. First, we will add a JavaScript file with the JavaScript functions that our service will need to use to update the browser's localStorage. Next, we will create the interface and class with the .NET methods that will invoke the JavaScript functions. Finally, we will test our service.
Creating the local storage service project
We need to create a new Blazor WebAssembly app. We do this as follows:
- Open Visual Studio 2019.
- Click the Create a new project button.
- In the Search for templates (Alt+S) textbox, enter
Blazor
and hit the Enter key.The following screenshot shows the Empty Blazor WebAssembly App project template that we created in Chapter 2, Building Your First Blazor WebAssembly Application:
- Select the Empty Blazor WebAssembly App project template and...