title: how to convert class to function by hook
body: <p>i need to convert this class to function</p>
  <pre><code>handleBooksSearch = async (search) =&gt; {
      await bookapi1.search(search).then((res) =&gt; {
        if (res &amp;&amp; !res.error) {
          this.setState({
            booksFromSearch:res.map((booksSearch)=&gt;{
              books.forEach((book)=&gt;{
                if(booksSearch.id===book.id) booksSearch.shelf=book.shelf
               
              })
  
              return booksSearch;
            }),
  
            loadsearch: true
          });
        } else {
          this.setState({
            booksFromSearch: `No_books_like: &quot; ${search} &quot;`,
             loadsearch: false
          })
        }
      }); 
  
    };
  </code></pre>