BlazoredLocalStorage
This library has been moved to the Blazored org
Install / Use
/learn @chrissainty/BlazoredLocalStorageREADME
BlazoredLocalStorage
A library to provide access to local storage in Blazor applications
Installing
You can install from Nuget using the following command:
Install-Package BlazoredLocalStorage
Or via the Visual Studio package manger.
Setup
First, you will need to register local storage with the service collection in your startup.cs file
public void ConfigureServices(IServiceCollection services)
{
services.AddLocalStorage();
}
Usage
This is an example of using local storage in a .cshtml file
@inject Blazored.Storage.ILocalStorage localStorage
@functions {
protected override async Task OnInitAsync()
{
await localStorage.SetItem("name", "John Smith");
var name = await localStorage.GetItem<string>("name");
}
}
The APIs available are
- SetItem()
- GetItem()
- RemoveItem()
- Clear()
- Length()
- Key()
All APIs are now async
Note: Blazored.LocalStorage methods will handle the serialisation and de-serialisation of the data for you.
Related Skills
node-connect
341.8kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.8kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
