0
0
NextJSframework~20 mins

Create Next App setup in NextJS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Next.js Setup Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📝 Syntax
intermediate
2:00remaining
Correct command to create a new Next.js app
Which command correctly creates a new Next.js app named my-app using the official recommended method?
Anpx create-next-app@latest my-app
Bnpm create next-app my-app
Cnext new my-app
Dnpm init next-app my-app
Attempts:
2 left
💡 Hint
Use the official Next.js recommended command with npx.
component_behavior
intermediate
2:00remaining
Default page output after creating a Next.js app
After running npx create-next-app@latest my-app and starting the development server, what will the default homepage display?
AA list of all files in the project directory
BA blank white page with no content
CA welcome page with Next.js logo and links to documentation
DAn error page saying 'Page Not Found'
Attempts:
2 left
💡 Hint
The default app includes a friendly welcome page.
🔧 Debug
advanced
2:00remaining
Fixing a missing dependency error after setup
You created a Next.js app with npx create-next-app@latest my-app but running npm run dev gives an error: Cannot find module 'react'. What is the most likely cause?
AYou must rename <code>package.json</code> to <code>next.json</code>
BThe Next.js app template does not include React by default
CYou need to downgrade Node.js to version 12
DYou forgot to run <code>npm install</code> before <code>npm run dev</code>
Attempts:
2 left
💡 Hint
Dependencies must be installed before running the app.
🧠 Conceptual
advanced
2:00remaining
Understanding the role of the pages directory
In a freshly created Next.js app, what is the main purpose of the pages directory?
AIt stores global CSS styles for the entire app
BIt automatically maps files to routes for the app's URLs
CIt contains configuration files for the Next.js build process
DIt holds server-side API code only
Attempts:
2 left
💡 Hint
Think about how URLs relate to files in Next.js.
state_output
expert
2:00remaining
Effect of editing app/page.tsx in Next.js 14 app router
In a Next.js 14 app created with the app router, you edit app/page.tsx to add a console.log('Hello') inside the default exported component function. What happens when you refresh the homepage in the browser?
NextJS
export default function Page() {
  console.log('Hello');
  return <h1>Welcome</h1>;
}
AThe message 'Hello' appears in the server console, not the browser console
BThe message 'Hello' appears in the browser console each time the page loads
CNo console message appears anywhere because console.log is ignored
DThe app crashes with a runtime error due to console.log usage
Attempts:
2 left
💡 Hint
Remember that Next.js 14 app router components run on the server by default.