app directory relate to the URLs users visit?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.
app?blog inside the app directory with a page file inside, what URL will Next.js serve for that page?Next.js automatically creates routes based on folder names. Adding a blog folder creates the /blog URL path.
/products/shoes in Next.js?page.js define pages.To create nested routes, you use folders for each segment. The file page.js inside app/products/shoes creates the /products/shoes URL.
app/blog/page.jsand inside
page.js you export a React component.Why might navigating to
/blog show a 404 error?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.
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?The component returns JSX with a main section containing a heading and paragraph. This renders exactly as described in option A.
