The code in this repository contains 2 approaches to fetch the JSON data from GitHub users API and render that data inside a React component.
- Fetch, a Web API available in browsers to fetch network resources.
- Axios, a
Promise
basednpm
library for browser and node.js.
To run this project on your machine, open your terminal and follow these steps to get the app running.
-
Fork this repository by clicking on the Fork button in your GitHub account
-
Clone the repo on your machine. Use your own github username in the placeholder below.
git clone git@github.com:<your-github-username>/access-external-api-react.git
-
Install dependencies
yarn install
-
Start the app
yarn start
-
Go to your
src/App.js
. InsideuseEffect()
hook, there are 2 functionsgetGitHubUserWithFetch()
andgetGiHubUserWithAxios()
. Feel free to play with any of these functions, they usefetch()
andaxios
to get data from the network and render into the React component.