Remix Fundamentals

Dynamic Params Exercise

Kent C. Dodds

Kent C. Dodds

Professional Trainer
Remix Fundamentals

Check out a free preview of the full Remix Fundamentals course

The "Dynamic Params Exercise" Lesson is part of the full, Remix Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Students are instructed to create dynamic routes to generate pages for blog posts. Extra credit exercises include adding post content and type guards for TypeScript.


Transcript from the "Dynamic Params Exercise" Lesson

>> Let's go ahead and start up exercise three. So node dev 3, you should be on localhost 4003 now. And go to the exercise 3, it''s dynamic params, and go to the readme there. And here we've got some background. For most applications, you don't have just set routes, you will have a route segment is an ID of something or some identifier.

In our case, that's the post name, so if actually click on these, you're gonna get a 404. That's cuz we're routing to the /post/slug. So that's where we're trying to get to. And so we don't wanna add a route for each one of these individually cuz the code is going to be all the same.

It's just the data that's different. And so we're gonna use dynamic route params for that. Give a little bit of background into that and how you do that and remix so you can look through that. And then for the actual exercise, we're going to be implementing that. We have a new file for you to create and a little bit edit in our server file.

And then we've got some extra credit for adding post content actually compiling that with marked which is already installed. And then you're doing more with TypeScript. I tried to separate the TypeScript for those of you who aren't super into TypeScript all the time. So TypeScript, I tried to make that a separate thing.

And then that's it for this exercise. All right, let's rock and roll.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now