feat: initial release - MorkNetVizualiser v1.0

This commit is contained in:
2026-06-07 19:31:43 +02:00
commit 5f8a43e652
19 changed files with 2954 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { useState, useCallback } from 'react';
export function useLocalStorage(key, defaultValue) {
const [value, setValueState] = useState(() => {
try {
const stored = localStorage.getItem(key);
return stored !== null ? JSON.parse(stored) : defaultValue;
} catch {
return defaultValue;
}
});
const setValue = useCallback((newVal) => {
setValueState(prev => {
const next = typeof newVal === 'function' ? newVal(prev) : newVal;
try { localStorage.setItem(key, JSON.stringify(next)); } catch {}
return next;
});
}, [key]);
return [value, setValue];
}