Why does the local storage get deleted when I refresh? – Javascript
In Next.js I'm using this code: const [card, setcard] = useState([]); useEffect(() => { localStorage.setItem('items', JSON.stringify(card)); }, [card]); useEffect(() => { const items = JSON.parse(localStorage.getItem('items')); if (items) { setcard(items); } }, []); I can see that when the value of…