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.

URL parameters with React Router

URL parameters with React Router

"

- [Instructor] Okay, so now that we've added this lovely nav bar to our application, the next thing that we're going to want to do is actually start implementing the article page. Now, remember that the article page, what was different about it, if we go back to our app component where we defined our routes, what was different about this is that it had this little URL parameter thing here. Now, URL parameters are generally used in React when we want a single component to be able to display multiple different pages, right? So for our article page, it's a single component, but we're going to want this to be able to display all of the different articles in our application as if we had one page for each article in our app. So what this means is that what we're going to need to do is take this article ID when we're inside our article page component and use that to load the data for the correct article that matches this ID.…

Inhalt