Skip to content
0

katanakit-js / useSetStorage

Function: useSetStorage() ​

ts
function useSetStorage(
   key, 
   value, 
   target?
): void;

Defined in: src/infrastructure/storage/storage.service.ts:369

Stores a value under the given key (serialized as JSON).

Parameters ​

ParameterTypeDefault valueDescription
keystringundefinedThe storage key.
valueunknownundefinedThe value to store.
target"localStorage" | "sessionStorage""localStorage"Which storage backend to use (default: "localStorage").

Returns ​

void

Example ​

ts
useSetStorage("auth_token", "abc123");
useSetStorage("user", { name: "Alice" }, "sessionStorage");

Released under the MIT License.