mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-16 12:36:40 +07:00
Aurum — a self-hosted personal finance operating system: cash flow, net worth tracking, budgets, goals, recurring payments, reports, proactive alerts, and a compound-interest returns calculator, all bilingual (RU/EN) and mobile-first. Ships as a three-container Docker Compose stack (Postgres + FastAPI + nginx-served React frontend). See README.md for setup and CONTRIBUTING.md for development.
16 lines
416 B
TypeScript
16 lines
416 B
TypeScript
import { useState } from "react";
|
|
|
|
export function useLocalStorageState(key: string, initial: boolean) {
|
|
const [value, setValue] = useState<boolean>(() => {
|
|
const stored = localStorage.getItem(key);
|
|
return stored === null ? initial : stored === "true";
|
|
});
|
|
|
|
const update = (next: boolean) => {
|
|
setValue(next);
|
|
localStorage.setItem(key, String(next));
|
|
};
|
|
|
|
return [value, update] as const;
|
|
}
|