From 792185de73c95c6064f04363f67e26e362cea7f7 Mon Sep 17 00:00:00 2001 From: Ken Jannette Date: Mon, 16 Apr 2018 20:01:56 -0400 Subject: [PATCH] set iniitial state to book data fetched by getAll --- src/App.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/App.js b/src/App.js index 458da01..f1ba456 100755 --- a/src/App.js +++ b/src/App.js @@ -8,10 +8,15 @@ import './App.css' class BooksApp extends React.Component { + state = { + books: [] + } + componentDidMount() { - getAll().then((books) => - console.log(books) - ) + getAll().then((books) => { + console.log(books) + this.setState({ books }) + }) } render() {