Seitu
A type-safe, framework-agnostic library for working with familiar hooks. Use it with React or without any framework—typed, testable, and usable outside components.
Documentation// Import needed function, e.g. local storageimport { createWebStorage } from 'seitu/web'// Use any Standard Schema library you wantimport * as z from 'zod'// Create an instance of the functionconst localStorage = createWebStorage({ type: 'localStorage', schemas: { count: z.number(), name: z.string() }, defaultValues: { count: 0, name: '' },})// Manipulate the instancelocalStorage.get() // { count: 0, name: '' }localStorage.set({ count: 1, name: 'John' })localStorage.subscribe(console.log)// Import framework hook to subscribe to the function outputimport { useSubscription } from 'seitu/react'export default function Page() { // Subscribe to the instance const count = useSubscription( localStorage, // Re-render only when count changes { selector: value => value.count } ) return ( <div> <span>{count}</span> <button onClick={() => count.set(c => c + 1)}>Increment</button> </div> )}