set iniitial state to book data fetched by getAll
This commit is contained in:
11
src/App.js
11
src/App.js
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user