Untitled
unknown
tsx
3 years ago
455 B
5
Indexable
useEffect(() => {
setTimeout(() => {
const item = localStorage.getItem(key);
if (item) {
try {
const decryptState = CryptoJS.AES.decrypt(item, protectKey).toString(
CryptoJS.enc.Utf8,
);
setState(JSON.parse(decryptState));
} catch {
localStorage.removeItem(key);
}
} else {
setState(initialValue);
}
}, 10);
}, [asPath, initialValue]);Editor is loading...