Remix Fundamentals

Nested Routing Exercise

Kent C. Dodds

Kent C. Dodds

Professional Trainer
Remix Fundamentals

Check out a free preview of the full Remix Fundamentals course

The "Nested Routing 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 add a route to /posts/admin to see a list of posts, /posts/admin/:slug to edit posts, and /posts/admin/new to create new posts.

Preview
Close

Transcript from the "Nested Routing Exercise" Lesson

[00:00:00]
>> So we're going to move on to exercise four now and I want you to take a second to write down your thoughts and everything. Pause the video so you can remember the stuff that you learned cuz this is important. And now we're gonna move on to exercise four, you're gonna be on port 4004.

[00:00:21]
And in this one, let me get myself over there as well. Open up the readme, we're gonna be talking about nested routing. So, so far our blog has a list of blog posts. Those are all seated in the database by the seed script. We wanna actually be able to write blog posts so we're going to add an admin interface to our app so that we can modify what's in the database so we can make changes and write new blog posts.

[00:00:48]
So to do that we're going to leverage a feature of remix called nested routing. I gave you a pretty good explainer here in the background so I'll leave you to that and then we can talk about it after. And then yeah, for the exercise we're adding a couple routes, post slash admin, a post slash admin slug, and a post slash admin new.

[00:01:09]
So those are the routes that we ultimately want to have. Well, eventually I don't think we're actually not adding the slug route yet, that will come later. But when you're all finished, your MPX remix routes should print out the same thing as what we have here. So you can take a look at that and compare.

[00:01:30]
And again, you'll have to cd into the directory to run that MPX remix routes. I give you some JSX because again, you're not here to learn React. And yeah, I think we're just gonna create a couple of files and stuff. So yeah, have fun with that exercise four.

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