diff --git a/src/App.js b/src/App.js index 6660887..cd278d0 100755 --- a/src/App.js +++ b/src/App.js @@ -47,7 +47,6 @@ class BooksApp extends React.Component { const id = e.target.name const newShelf = e.target.value const books = this.state.books - books.forEach((book) => { if (book.id === id) { book.shelf = newShelf; diff --git a/src/Bookshelf.js b/src/Bookshelf.js index 28b274d..107bc7a 100644 --- a/src/Bookshelf.js +++ b/src/Bookshelf.js @@ -5,7 +5,6 @@ class Bookshelf extends Component { render() { const books = this.props.books const onSelect = this.props.onSelect - return (
diff --git a/src/SearchPage.js b/src/SearchPage.js index 307729a..b78530e 100644 --- a/src/SearchPage.js +++ b/src/SearchPage.js @@ -15,10 +15,10 @@ class SearchPage extends Component { const books = this.props.books if (query.length > 3) { search(query).then((results) => { - for (var result in results) { - for (var book in books) { - if (result === book) { - result.shelf = book.shelf + for (var i = 0; i < books.length; i++) { + for (var j = 0; j < results.length; j++) { + if (results[j] === books[i]) { + results[j].shelf = books[i].shelf } } }