import React, { Component } from 'react'; import { Link } from 'react-router-dom' import { search } from './BooksAPI' class SearchPage extends Component { constructor(){ super(); this.state = { results: [], } } onSearch = (query) => { const books = this.props.books if (query.length > 3) { search(query).then((results) => { for (var result of results) { for (var book of books) { if (result.title === book.title) { result.shelf = book.shelf } } } this.setState({ results }); }) } }; render() { const onSelect = this.props.onSelect return (