Member-only story
How To Fetch Data From an API With React Hooks
Functional data fetching

React Hooks let us write pure functional components without ever using the class syntax. Usually, but not always, the less code we have to write, the faster we’re building our application.
If you’re new to Hooks, check out this tutorial for a Hooks introduction.
Feel free to become a Medium member by using my referral link. Your membership fee directly supports me and other writers you read. You’ll also get full access to every story on Medium
Step 1. Refactoring From a Class to Functional Component
Take this plain React class-based component. Our first step to using Hooks would be to refactor it to a functional component. Remember, you use Hooks only with functional components.