logo

Killua
is a localStorage management library for React applications.

Simplify localStorage management in your React applications using Killua, a robust library specifically designed for efficient handling of localStorage operations.

Get Started
// slices/counter.ts
import { slice } from "killua";

export const counterSlice = slice({
  key: "counter",
  defaultClient: 1,
  // optional ...
  defaultServer: 3,
  expire: '0d-0h-0m-10s',
  obfuscate: true,
  schema: z.number().min(0).max(10),
  reducers: {
    increment: value => value + 1,
    incrementWithPayload: (value, payload: number) => value + payload
  },
  selectors: {
    getPlusOne: value => value + 1,
    getPlusWithPayload: (value, payload: number) => value + payload
  }
});

Features

1

Get data from localStorage

Easily retrieve and access stored data from localStorage without any hassle, ensuring convenient data management and utilization.

2

Set data to localStorage

Effortlessly store and manage data in localStorage, allowing for easy access and retrieval when needed.

3

Reducer for state management

Implement a reducer for effective state management, allowing for structured data updates.

4

Selector for data access

Use a selector to efficiently access and retrieve data stored in localStorage.

5

Expiration timer

Implement an expiration timer for stored data to automatically remove outdated information.

6

Schema validation

Utilize schema validation to ensure the accuracy and integrity of stored data.

7

Obfuscate data in localStorage

obfuscate data in localStorage to obscure information.

8

Server-Side Compatibility

Fully compatible with server-side applications for seamless integration.

9

TypeScript friendly

Built with TypeScript, ensuring type safety and compatibility with TypeScript applications.

10

Auto update in other tabs

Automatically update stored data in other open browser tabs or windows when changes occur.

11

Auto update in other components

Automatically update data in other components of the application when changes occur in localStorage.

12

Config file for configuration management

Utilize a configuration file to manage various settings and options in the application.