From 877e62fdf40189dd1ce96d6057cd1bcc60a0829a Mon Sep 17 00:00:00 2001 From: Ken Jannette Date: Mon, 16 Apr 2018 19:53:34 -0400 Subject: [PATCH] Added call to getAll on app initialization to load books data --- src/App.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/App.js b/src/App.js index 20db170..458da01 100755 --- a/src/App.js +++ b/src/App.js @@ -2,18 +2,16 @@ import React from 'react' import { BrowserRouter, Link, Route } from 'react-router-dom' // import * as BooksAPI from './BooksAPI' import Bookshelf from './Bookshelf' +import { getAll } from './BooksAPI' import SearchPage from './SearchPage' import './App.css' class BooksApp extends React.Component { - state = { - /** - * TODO: Instead of using this state variable to keep track of which page - * we're on, use the URL in the browser's address bar. This will ensure that - * 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 + + componentDidMount() { + getAll().then((books) => + console.log(books) + ) } render() {