From 7e1068eb76ad4a4650f4f5f300564916cac9100a Mon Sep 17 00:00:00 2001 From: Ken Jannette Date: Thu, 19 Apr 2018 10:52:53 -0400 Subject: [PATCH] Added setState call in app.js --- src/App.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/App.js b/src/App.js index 50f56cb..f9e18d8 100755 --- a/src/App.js +++ b/src/App.js @@ -18,16 +18,18 @@ class BooksApp extends React.Component { componentDidMount() { getAll().then((books) => { this.setState({ books }) - console.log(this.state.books[0].id) }) } onSelectChange = (e) => { const id = e.target.name - const shelf = e.target.value -// console.log(id, shelf) - const changeShelf = this.state.books.filter((book, id) => book.id === id) + const newShelf = e.target.value + console.log(id, newShelf) + const changeShelf = this.state.books.filter((book) => { return book.id === id}) console.log("changeShelf: ", changeShelf) + this.setState({ + changeShelf.shelf: changeShelf.newShelf + }) } render() {