课程: React: Creating and Hosting a Full-Stack Site

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

The Axios library

The Axios library

- [Instructor] Okay, so at this point we have a working front end and a working backend, which we just created with Express and MongoDB. So now what we need to do is bring the front end and backend together using network requests. Essentially what we want to do is have our front end make requests to our backend in a very similar way to how we've been making requests to the backend using Postman. The main difference is that the front end will be allowing the user to do this automatically by doing things like clicking buttons, adding comments, things like that. Now, there are many libraries that we can use in order to load data from the backend in React, but the one that we're going to be using here is called Axios. So what you're going to want to do is open up a terminal and we're going to install Axios into the front end. Make sure you're in the front end directory by changing directories into the front end. And then we're going to say npm install axios. So that will install that…

内容