Untitled
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]);