From 129f09b76dc76d58aada787965bb6ed0fe5f6d14 Mon Sep 17 00:00:00 2001 From: Ken Jannette Date: Fri, 20 Apr 2018 13:29:59 -0400 Subject: [PATCH] Editing SearchPage to fix bug(s) --- src/SearchPage.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/SearchPage.js b/src/SearchPage.js index 1eea695..82c065c 100644 --- a/src/SearchPage.js +++ b/src/SearchPage.js @@ -4,13 +4,18 @@ import { search } from './BooksAPI' class SearchPage extends Component { + constructor(){ + super(); + this.results = '' + } + onSearch = (query) => { if (query.length > 3) { - search(query).then((results) => { - this.results = results - }) - } -} + search(query).then((searchResults) => { + this.results = searchResults + }) + } + }; render() { @@ -26,14 +31,14 @@ class SearchPage extends Component { onSearch(e.target.value)} + onChange={e => this.onSearch(e.target.value)} />
    - {results.map((result) => + {this.results.map((result) =>