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 comments

Adding comments

"

- [Instructor] All right, so now that we've got our server working fairly well and we've implemented upvote functionality and made it restart automatically, the next thing that we're going to do is add the ability for users to add comments to articles to our server. Okay, so the first thing that we're going to want to do here before we create a new endpoint for adding comments to articles is we're going to go up here to our articles info in-memory fake database thing and we're going to add another property to each of these that will store the comments for each article. So what we're going to do is we're just going to add a comments property to each of these, and the starting value for this is going to be an empty array. Now, what we're going to do is inside the endpoint that we create for adding comments, we're basically just going to take any information that we get from the user, such as the comment text and create a…

Inhalt