Complete the code to create a route group named 'admin' in Next.js.
export const metadata = { title: 'Admin Dashboard' };
export default function [1]() {
return <h1>Admin Area</h1>;
}
// Place this file inside (admin) folderIn Next.js App Router, the file named page.js or page.tsx defines the route component inside a folder. The folder named with parentheses like (admin) groups routes but the component file must be named page.
Complete the code to import a component from a route group folder named '(dashboard)'.
import [1] from './(dashboard)/page'; export default function Home() { return <div><[1] /></div>; }
You import the component by the name you export it as. Since the component inside page.js is usually a default export with a name like DashboardPage, you import it with that name.
Fix the error in the route group folder naming to correctly group routes under 'profile'.
app/[1]/settings/page.tsx
// This file renders the settings page inside the profile groupRoute groups in Next.js use parentheses around the folder name, like (profile), to group routes without affecting the URL path.
Fill both blanks to create a route group named 'shop' and a page component inside it.
app/[1]/page.tsx export default function [2]() { return <h1>Shop Home</h1>; }
The route group folder is named with parentheses (shop). The page component inside is a default export function, here named ShopPage.
Fill all three blanks to create a nested route group '(account)', a page component, and export metadata.
app/[1]/page.tsx export const metadata = [2]; export default function [3]() { return <h1>Account Overview</h1>; }
The folder for the route group uses parentheses (account). Metadata is exported as an object with a title. The component function is named AccountPage.