Script Valley
Next.js: Full-Stack React Applications
Routing, Navigation, and Dynamic Segments/Assessment

Practice & Assessment

Test your understanding of Routing, Navigation, and Dynamic Segments

Multiple Choice Questions

5
1

You want to import useRouter for programmatic navigation in the App Router. Which import is correct?

2

What does wrapping a folder name in parentheses do in the App Router? (e.g., (marketing))

3

Where must middleware.ts be placed in a Next.js project?

4

You call notFound() inside a Server Component. What happens?

5

Which of the following is a valid use case for middleware.ts?

Coding Challenges

1
1

Build a Filterable Product Catalog

Create a /products page that fetches an array of 10 hardcoded products (id, name, category: 'electronics'|'clothing'|'books', price). The page should read a category search param from the URL (/products?category=electronics) and filter the displayed products accordingly. Include a /products/[id] dynamic route that shows full product details. Add a not-found.tsx that renders a custom 404 message when an invalid ID is visited. No database needed โ€” use a hardcoded array as your data source. Expected output: /products?category=books shows only books; /products/999 shows the custom 404. Time estimate: 20-25 minutes.

Medium

Mini Project

1

Documentation Site with Nested Navigation

Build a documentation site with the following routing structure: (public) route group with a marketing homepage and /pricing static page; (docs) route group with its own sidebar layout; /docs/[section]/[topic] dynamic route rendering hardcoded markdown-like content; search at /docs/search reading a q param and filtering topics; middleware that redirects /old-docs to /docs. The sidebar must use Link with active state styling (use usePathname from next/navigation in a Client Component). Include generateStaticParams for 5 pre-defined section/topic combinations. All data fetching must happen in Server Components.

Medium
Practice & Assessment โ€” Routing, Navigation, and Dynamic Segments โ€” Next.js: Full-Stack React Applications โ€” Script Valley โ€” Script Valley