From the course: React: Creating and Hosting a Full-Stack Site

Schalten Sie den kompletten Kurs noch heute frei

Join today to access over 23,400 courses taught by industry experts.

Adding React hooks

Adding React hooks

"

- [Instructor] All right, so now that we've installed the Axios library and we know the basic syntax that it uses, let's take a look at how to load data into our article page from the server. So, the first thing that we're going to want to do here is open up our article page. And this is where we're going to be writing most of our code for this video. So, our basic goal here with loading data is when we visit the article page, right, when one of our article pages is first displayed, we'll want that page to make a request to our server. And we'll want our server, obviously, to send back the number of upvotes and comments for that article, which our article page will then display. So, there's a few steps here. The first thing that we're going to need to do is actually load the data in the first place. And then we'll need to add a few more components and elements down here in our article page's JSX, you know and create…

Inhalt