From the course: React: State Management (2019)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Data fetching only using React

Data fetching only using React - React.js Tutorial

From the course: React: State Management (2019)

Start my 1-month free trial

Data fetching only using React

- [Instructor] One of the most common ways to introduce complexity into your app is by introducing an API call. Where should that API call live? What should we do with that data once we have it? It's easy to jump to a more complex solution that involves Redux, setting up Boilerplate, et cetera. In lots of causes though, using the built-in React methods suffice just fine. Let's take a look at our book collection example. Suppose we don't want to use a hard-coded set of books, and maybe we want to re-read Jane Austen books. In order to that, we're going to be using the Google Books API. Let's take a look specifically at the performing a search section. We can use the Google Books API to dynamically load the books for a given author using this inauthor query string. What we want is we want for these books to dynamically appear for the users when they first load the page. But which React life cycle should we look at? There are a couple of different options. The first one is…

Contents