improved password protection code

This commit is contained in:
Quentin Roussel
2024-03-28 20:47:05 +01:00
parent ba7abe3b3c
commit 27e5a6615a
14 changed files with 137 additions and 111 deletions

View File

@@ -3,6 +3,7 @@ import { useEffect, useState } from "react";
export function useLocalStorage(key, initialValue) {
const [storedValue, setStoredValue] = useState(initialValue);
const [loading, setLoading] = useState(true);
useEffect(() => {
try {
@@ -11,6 +12,7 @@ export function useLocalStorage(key, initialValue) {
} catch (error) {
console.log(error);
}
setLoading(false);
}, []);
const setValue = value => {
@@ -23,5 +25,5 @@ export function useLocalStorage(key, initialValue) {
}
}
return [storedValue, setValue];
return [storedValue, setValue, loading];
}