diff --git a/src/pages/note.jsx b/src/pages/note.jsx
index e8e6564..b0e9ceb 100644
--- a/src/pages/note.jsx
+++ b/src/pages/note.jsx
@@ -37,6 +37,8 @@ function NotePage() {
let note = notes[params.id];
let [edit, setEdit] = useState(false);
+ let [text, setText] = useState(note.text);
+ let [name, setName] = useState(note.name);
return (
@@ -52,17 +54,17 @@ function NotePage() {
<>
(note.name = e.target.value)}
+ onChange={(e) => setName(e.target.value)}
/>
(note.text = e.target.value)}
+ onChange={(e) => setText(e.target.value)}
/>
{
- note.text = text;
+ setText(text);
}}
/>
@@ -81,11 +83,12 @@ function NotePage() {
text={locals.Edit}
icon={PencilIcon}
onClick={() => {
- setEdit(!edit);
+ notes[params.id].name = name;
+ notes[params.id].text = text;
- if (edit) {
- localStorage.setObj("Notes", notes);
- }
+ localStorage.setObj("Notes", notes);
+
+ setEdit(!edit);
}}
/>
{!edit && (