Skip to content

Instantly share code, notes, and snippets.

@sabesansathananthan
Created February 23, 2021 06:34
Show Gist options
  • Save sabesansathananthan/79d353fc26e265502567c56c3a7887ed to your computer and use it in GitHub Desktop.
Save sabesansathananthan/79d353fc26e265502567c56c3a7887ed to your computer and use it in GitHub Desktop.
Axios Vs Fetch
axios.all([
axios.get('https://api.github.com/users/sabesansathananthan'),
axios.get('https://api.github.com/users/rcvaram')
])
.then(axios.spread((obj1, obj2) => {
// Both requests are now complete
console.log(obj1.data.login + ' has ' + obj1.data.public_repos + ' public repos on GitHub');
console.log(obj2.data.login + ' has ' + obj2.data.public_repos + ' public repos on GitHub');
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment