Added call to getAll on app initialization to load books data
This commit is contained in:
14
src/App.js
14
src/App.js
@@ -2,18 +2,16 @@ import React from 'react'
|
|||||||
import { BrowserRouter, Link, Route } from 'react-router-dom'
|
import { BrowserRouter, Link, Route } from 'react-router-dom'
|
||||||
// import * as BooksAPI from './BooksAPI'
|
// import * as BooksAPI from './BooksAPI'
|
||||||
import Bookshelf from './Bookshelf'
|
import Bookshelf from './Bookshelf'
|
||||||
|
import { getAll } from './BooksAPI'
|
||||||
import SearchPage from './SearchPage'
|
import SearchPage from './SearchPage'
|
||||||
import './App.css'
|
import './App.css'
|
||||||
|
|
||||||
class BooksApp extends React.Component {
|
class BooksApp extends React.Component {
|
||||||
state = {
|
|
||||||
/**
|
componentDidMount() {
|
||||||
* TODO: Instead of using this state variable to keep track of which page
|
getAll().then((books) =>
|
||||||
* we're on, use the URL in the browser's address bar. This will ensure that
|
console.log(books)
|
||||||
* users can use the browser's back and forward buttons to navigate between
|
)
|
||||||
* pages, as well as provide a good URL they can bookmark and share.
|
|
||||||
*/
|
|
||||||
showSearchPage: false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|||||||
Reference in New Issue
Block a user