Data fetching in React

Things to cover in this section

  • Project Setup
  • Understanding folder structure
  • creating the very first class component
  • installing axios
  • API documentation
  • initialising componentDidMount() lifecycle method for fetching data
  • Updating the fetched data to the UI 🎉
  • Finally, done with the section! ✌️

Project Setup

npm

git checkout bootcamp
npm install or npm i

yarn

git checkout bootcamp
yarn

axios installation

npm install axios or npm i axios

yarn

yarn add axios

API documentation

API_ENDPOINT: https://jsonplaceholder.typicode.com/users/1/posts

You can find the code we did for this section in bootcamp-fetch branch.

🌲 branch: git checkout bootcamp-fetch

← Building a Counter appFinal Thoughts →