UseSetStorage
katanakit-js / useSetStorage
Function: useSetStorage()
Section titled “Function: useSetStorage()”function useSetStorage(key, value, target?): void;Defined in: infrastructure/storage/storage.service.ts:369
Stores a value under the given key (serialized as JSON).
Parameters
Section titled “Parameters”| Parameter | Type | Default value | Description |
|---|---|---|---|
key |
string |
undefined |
The storage key. |
value |
unknown |
undefined |
The value to store. |
target? |
"localStorage" | "sessionStorage" |
"localStorage" |
Which storage backend to use (default: "localStorage"). |
Returns
Section titled “Returns”void
Example
Section titled “Example”useSetStorage("auth_token", "abc123");useSetStorage("user", { name: "Alice" }, "sessionStorage");