In this tutorial, you will learn how to create nested dynamic routes.
Next.js allows dynamic routing to represent complex data structures like
categories → blog or user → posts.
Example of Dynamic Routes
URL: /blog/health/101
Folder Structure:
app/blog/[category]/[id]/page.js
Example:
export default function Page({ params }) {
const { category, id } = params;
return (
<div>
<h1>Category: {category}</h1>
<h2>Blog ID: {id}</h2>
</div>
);
}
Note: Nested dynamic routes help you model multi-level URLs in a clean and organized way.
When to use Nested Dynamic Routes?
There are many options where we have to use Nested Dynamic Routes.
1. Blog → author → post
2. Country → city → area
3. Department → team → member
4. Category → subcategory → product
Nested Dynamic Routes in Next.js – Interview Questions
Q 1: What are nested dynamic routes?
Ans: Dynamic routes inside another dynamic route.
Q 2: How are they created?
Ans: Using nested folders like [user]/[post].
Q 3: How are params accessed?
Ans: Through the params object.
Q 4: Are nested routes share layouts?
Ans: Yes.
Q 5: Are nested dynamic routes common?
Ans: Yes, in blogs and dashboards.
Nested Dynamic Routes in Next.js – Objective Questions (MCQs)
Q1. Nested dynamic routes are created by:
Q2. Which folder structure creates /blog/2025/post-1?
Q3. How many dynamic segments can a route have?
Q4. Nested dynamic routes are useful for:
Q5. Which hook accesses nested route parameters?