The use-case for our simple React app is one from traditional e-commerce applications, that is, searching for a product in a giant inventory. In our case, the search is for books. We will use the Goodreads API to search for a book by title or author. Goodreads requires us to register an account to use their API.
Create a Goodreads account by visiting this URL: https://www.goodreads.com/api/keys. You can use your Amazon or Facebook account to log in. Once you have the account, you need to generate an API key to make the API calls.
Goodreads exposes a set of endpoints that give back the results in XML. Agreed, it's not ideal, but they have an extensive collection of books and it's a small price to pay to convert XML into a JSON object. In fact, we will use an
npm package for this conversion. The endpoint we will be using is search-books (https://www.goodreads.com/search/index.xml?key=API_KEY&q=SEARCH_TERM).
The UI for our app will look something like the following: