diff --git a/src/plays/sticky-notes/App.js b/src/plays/sticky-notes/App.js index 85db7bfd2..32fa0295b 100644 --- a/src/plays/sticky-notes/App.js +++ b/src/plays/sticky-notes/App.js @@ -31,16 +31,18 @@ function App() { const handleSubmit = (e) => { e.preventDefault(); - const newNote = { - ...note, - id: Math.random() * 10 - }; - - setNotes([newNote, ...notes]); - setNote({ - body: '' - }); - setToggleForm(!toggleForm); + if (note.body) { + const newNote = { + ...note, + id: Math.random() * 10 + }; + + setNotes([newNote, ...notes]); + setNote({ + body: '' + }); + setToggleForm(!toggleForm); + } }; const handleDelete = (id) => {