set iniitial state to book data fetched by getAll

This commit is contained in:
Ken Jannette
2018-04-16 20:01:56 -04:00
parent 877e62fdf4
commit 792185de73

View File

@@ -8,10 +8,15 @@ import './App.css'
class BooksApp extends React.Component { class BooksApp extends React.Component {
state = {
books: []
}
componentDidMount() { componentDidMount() {
getAll().then((books) => getAll().then((books) => {
console.log(books) console.log(books)
) this.setState({ books })
})
} }
render() { render() {