Challenge - 5 Problems
File-Based Routing Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
How does Next.js file-based routing map URLs?
In Next.js, how does the file structure inside the
app directory relate to the URLs users visit?Attempts:
2 left
💡 Hint
Think about how folder names become parts of the website address.
✗ Incorrect
Next.js uses the file and folder names inside the app directory to create URL paths automatically. This means if you have a folder named about, it becomes the /about URL.
❓ component_behavior
intermediate2:00remaining
What happens when you add a new folder in Next.js
app?If you add a new folder named
blog inside the app directory with a page file inside, what URL will Next.js serve for that page?Attempts:
2 left
💡 Hint
Remember how folder names become URL parts.
✗ Incorrect
Next.js automatically creates routes based on folder names. Adding a blog folder creates the /blog URL path.
📝 Syntax
advanced2:00remaining
Identify the correct file structure for nested routes
Which folder and file structure correctly creates the nested URL
/products/shoes in Next.js?Attempts:
2 left
💡 Hint
Folders create URL segments, files named
page.js define pages.✗ Incorrect
To create nested routes, you use folders for each segment. The file page.js inside app/products/shoes creates the /products/shoes URL.
🔧 Debug
advanced2:00remaining
Why does this Next.js route not work as expected?
Given this folder structure:
and inside
Why might navigating to
app/blog/page.jsand inside
page.js you export a React component.Why might navigating to
/blog show a 404 error?Attempts:
2 left
💡 Hint
Check the component export inside the page file.
✗ Incorrect
Next.js requires that page.js files export a React component as the default export. Without it, the route won't render and may show 404.
❓ state_output
expert2:00remaining
What is the rendered output of this Next.js page component?
Consider this Next.js page component inside
What will a user see when visiting
app/home/page.js:export default function HomePage() {
return (
<main>
<h1>Welcome</h1>
<p>You are at /home</p>
</main>
)
}What will a user see when visiting
/home?Attempts:
2 left
💡 Hint
Look at the JSX returned by the component.
✗ Incorrect
The component returns JSX with a main section containing a heading and paragraph. This renders exactly as described in option A.