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

今天就学习课程吧!

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

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…

内容