Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Data Fetching in React!
You have completed Data Fetching in React!
Preview
Learn to make server requests in React using Axios, a promised-based library that's similar to the Fetch API.
Axios Snippet
axios.get()
.then(function (response) {
// handle success
})
.catch(function (error) {
// handle error
console.log(error);
})
Resources
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
a promise based library that's
similar to the Fetch API we used in
0:00
the previous video.
0:01
Like the Fetch API, Axios isn't specific
to React, so you can use it to fetch
0:03
data in other JavaScript frameworks and
libraries or any Node.js app.
0:09
Axios has useful built in features, for
example, Axios supports the Promise API.
0:15
It lets you intercept requests or
responses and
0:22
alter them before they're handled
by the then or catch method.
0:25
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up