课程: React: Creating and Hosting a Full-Stack Site (2022)
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Displaying comments
- [Instructor] All right, so our article page component is now correctly loading the information about the articles that it displays, and it's correctly displaying the number of up votes that a given article has. So the next step for us here is going to be to build a new component that will display the comments for an article, right? Currently we're not displaying those comments anywhere on our page. So what we're going to do is open up our IDE, and over here, we're going to go into our components directory and add a new file here which we'll call CommentsList.js. And this is going to be the component that will display all of our comments. So let's start off by just creating a very simple component with a fairly simple JSX structure. And that's going to look like this. We're going to say const CommentsList = and this component is going to take a single prop called comments, which will be the comments that we want it to…