ReactRouting & formsLesson 37 / 69

Client-side routing

Exercise35 min

Client-side routing

Routing means: URL = state. The route decides what renders; the back button just works:

<Link href={`/roadmaps/fullstack/${course.id}`}>{course.title}</Link>

// the page component reads its param
const { courseId } = await params;

The discipline that keeps routing clean: put real, shareable state in the URL (lesson id, tab), and ephemeral state in component state (which accordion is open). If a user would want to bookmark it, it belongs in the URL.

Exercise

Sketch the routes for this roadmap app: /, /roadmaps/fullstack, /roadmaps/fullstack/:courseId, /lab/diagram. Write what each route renders.

Practice in the diagram lab

This lesson's practice belongs in the diagram editor — design the schema you just read about, grade it against the solution, and save it to your account.

Open the diagram lab