Loading data from APIs in React
ReactJS is a brilliant framework to work in, and something that I get asked a lot by people new to the framework is how best to deal with loading data from an external source, such as an API. In today's 10 minute video I show you how to create a component that can fetch data from an API and render it onto the page.
You'll learn about the React lifecycle and which method is best for making HTTP requests, how to use the
fetch API to get JSON from an API, and how to deal with errors as well as successful responses.
PS: it's definitely worth making the video fullscreen or viewing on Youtube so you can see things more clearly.
If you'd like to play with this code, you can find the repository on GitHub, and look out for the follow up episode in a few weeks where we look at some libraries that can make fetching external data much nicer.