From the course: MERN Essential Training (2020)

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add the state and Axios

Add the state and Axios

From the course: MERN Essential Training (2020)

Start my 1-month free trial

Add the state and Axios

- [Male] So let's work on creating our state for the entire application. So the first thing we're going to do is go back to the terminal, and install another package. So, let's go to the terminal, actually we could do just Control + ', and then turn this one down by doing Control + C, and we're going to be doing npm install axios, and that's a library that will allow us to do calls to the APIs, but with simple syntax. Okay, so now that we have the Axios library installed, we can start the application again, so npm start, close this down, and then we're going to do a lot of refactoring here, just to make sure that we are first, using a class component here, so the first thing we're going to do is class, and then remove the parenthesis, and then do extends React.Component, like so, and then inside of that class, we're going to add a render method, open curly braces, and then close it at the end, right here, like so…

Contents