Skip to content

Commit

Permalink
fix: null message validation on add button
Browse files Browse the repository at this point in the history
  • Loading branch information
NayanUnni95 committed Sep 30, 2024
1 parent 8b4b622 commit 68e7892
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/components/ToDoMain.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ function ToDoMain() {
/>
<button
onClick={() => {
setToDo([
...toDo,
{
des: data,
id: Date.now(),
check: false,
},
]),
clearInput();
if (data && data.trim() != '') {
setToDo([
...toDo,
{
des: data,
id: Date.now(),
check: false,
},
]),
clearInput();
} else {
alert('Empty Message...');
}
}}
>
<i className="fa-solid fa-plus fa-xl"></i>
Expand Down

0 comments on commit 68e7892

Please sign in to comment.