No message

This commit is contained in:
Ken Jannette
2018-04-20 16:32:39 -04:00
parent 7bdb93b6b2
commit 3f173a8098

View File

@@ -6,14 +6,16 @@ class SearchPage extends Component {
constructor(){ constructor(){
super(); super();
let results = '' this.state = {
results: [],
}
} }
onSearch = (query) => { onSearch = (query) => {
if (query.length > 3) { if (query.length > 3) {
search(query).then((searchResults) => { search(query).then((results) => {
this.results = searchResults
}) })
this.setState({ results });
} }
}; };
@@ -36,9 +38,9 @@ class SearchPage extends Component {
<div className="search-books-results"> <div className="search-books-results">
<ol className="books-grid"> <ol className="books-grid">
if (this.results) { if (this.state.results) {
{this.results.map((result) => this.state.results.map((result) =>
<li key={result.id}> <li key={result.id}>
<div className="book"> <div className="book">
@@ -59,7 +61,7 @@ class SearchPage extends Component {
</div> </div>
</li> </li>
)} )
} }