Challenge - 5 Problems
Next.js Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What is the purpose of the app directory in Next.js 14?
In Next.js 14, what is the main role of the
app directory in a project?Attempts:
2 left
💡 Hint
Think about where you define pages and layouts in Next.js 14.
✗ Incorrect
The
app directory is where you create server components and define routes using folders and files. It controls the UI structure and navigation.❓ component_behavior
intermediate2:00remaining
What happens if you place a page file outside the app directory?
In a Next.js 14 project, what will happen if you create a page file like
page.tsx outside the app directory?Attempts:
2 left
💡 Hint
Where does Next.js expect page files in the new app router?
✗ Incorrect
Next.js 14 expects page files inside the
app directory. Files outside are ignored for routing.📝 Syntax
advanced2:00remaining
Identify the correct file to define a layout for all pages in Next.js 14
Which file should you create inside the
app directory to define a layout that wraps all pages in your Next.js 14 app?Attempts:
2 left
💡 Hint
Layouts wrap pages and share UI like headers or footers.
✗ Incorrect
The
layout.tsx file inside the app directory defines a layout component that wraps all nested pages and components.🔧 Debug
advanced2:00remaining
Why does this Next.js 14 project fail to load the homepage?
Given this project structure:
- app/
- layout.tsx
- home.tsx
Why does the homepage not load at the root URL?
Attempts:
2 left
💡 Hint
Next.js uses specific file names for routing.
✗ Incorrect
Next.js 14 requires the homepage file to be named
page.tsx inside the app directory to serve it at the root URL.❓ lifecycle
expert3:00remaining
How does Next.js 14 handle server and client components in the app directory?
In Next.js 14, how does the framework decide which components in the
app directory run on the server versus the client?Attempts:
2 left
💡 Hint
Look for a special directive string at the top of files.
✗ Incorrect
Next.js 14 treats components as server components by default. Adding
'use client' at the top marks them as client components.