Skip to content

Commit

Permalink
Remove comented codes
Browse files Browse the repository at this point in the history
  • Loading branch information
TadesseDev committed May 4, 2022
1 parent 8632b11 commit d3a2c2d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/components/Books.js
Expand Up @@ -8,7 +8,6 @@ export default function Books() {
const dispatch = useDispatch();
const books = useSelector((store) => store.books);
useEffect(() => {
// console.log('data');
dispatch(getBooksFromServer());
}, []);
return (
Expand Down
12 changes: 7 additions & 5 deletions src/components/sub-components/AddNewBook.js
Expand Up @@ -6,15 +6,17 @@ export default function AddNewBook() {
const dispatch = useDispatch();
const handleNewBookSubmit = (event) => {
event.preventDefault();
const title = event.target.elements[0].value;
const author = event.target.elements[1].value;
dispatch(addBook(title, author));
const title = event.target.elements[0];
const author = event.target.elements[1];
dispatch(addBook(title.value, author.value));
title.value = '';
author.value = '';
};
return (
<div id="add-new-book">
<form action="#" method="POST" onSubmit={handleNewBookSubmit}>
<input type="text" name="title" id="title" placeholder="Book Title" />
<input type="text" name="author" id="author" placeholder="Book author" />
<input type="text" name="title" id="title" placeholder="Book Title" required />
<input type="text" name="author" id="author" placeholder="Book author" required />
<button type="submit">Add Book</button>
</form>
</div>
Expand Down

0 comments on commit d3a2c2d

Please sign in to comment.