I am new at this and I am creating a note app, but the new notes that I add are not being saved on the Local Storage. It does appear on the Application but when the page is refreshed, it disappears. Where am I getting it wrong?
const savedNotes = JSON.parse(
localStorage.getItem('notes-app-data')
);
if (savedNotes) {
setNotes(savedNotes);
}
}, []);
useEffect(() => {
localStorage.setItem(
'notes-app-data',
JSON.stringify(notes)
);
}, [notes]);```