Skip to content

Commit

Permalink
fixed empty notes adding bug (reactplay#986)
Browse files Browse the repository at this point in the history
* sticky notes app completed

* fixed the bugs and added preview img

* added video and moved the body-style class to line 13

* fixed empty notes getting added

* fixed empty notes getting added

* fixed empty notes getting added

---------

Co-authored-by: Tapas Adhikary <[email protected]>
  • Loading branch information
Coderamrin and atapas committed Feb 23, 2023
1 parent d4aec03 commit c2c5d5c
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/plays/sticky-notes/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit c2c5d5c

Please sign in to comment.