0
0
NextJSframework~10 mins

Parallel routes (@slot) in NextJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a parallel route segment in Next.js using the correct folder name syntax.

NextJS
app/dashboard/[1]profile/page.tsx
Drag options to blanks, or click blank then click option'
A(user)
B[user]
Cprofile
D{user}
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets instead of parentheses for parallel routes.
Using curly braces which are invalid folder name syntax.
2fill in blank
medium

Complete the code to render a parallel route slot inside the dashboard layout component.

NextJS
export default function DashboardLayout({ children, [1] }) {
  return (
    <div>
      <nav>Dashboard menu</nav>
      <main>
        {children}
        [1]
      </main>
    </div>
  )
}
Drag options to blanks, or click blank then click option'
Aparallel
Bprofile
Cslot
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'children' instead of 'slot' for parallel routes.
Trying to render 'parallel' or 'content' which are not props.
3fill in blank
hard

Fix the error in the parallel route folder naming to correctly define two parallel routes 'profile' and 'settings'.

NextJS
app/dashboard/[1]profile+settings/page.tsx
Drag options to blanks, or click blank then click option'
A(profile+settings)
B[profile+settings]
Cprofile+settings
D{profile+settings}
Attempts:
3 left
💡 Hint
Common Mistakes
Not using parentheses, which breaks parallel route syntax.
Using square brackets or curly braces which are invalid here.
4fill in blank
hard

Fill both blanks to correctly define a layout that renders children and a parallel route slot named 'settings'.

NextJS
export default function DashboardLayout({ children, [1] }) {
  return (
    <div>
      <header>Dashboard</header>
      <section>
        {children}
        [2]
      </section>
    </div>
  )
}
Drag options to blanks, or click blank then click option'
Asettings
Bslot
CsettingsSlot
Dparallel
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing the prop name with the parallel route name.
Trying to render 'parallel' or 'settingsSlot' which are not valid.
5fill in blank
hard

Fill all three blanks to create a parallel route folder, layout, and render the slot correctly for a 'chat' parallel route.

NextJS
app/dashboard/[1]/layout.tsx

export default function DashboardLayout({ children, [2] }) {
  return (
    <div>
      <nav>Menu</nav>
      <main>
        {children}
        [3]
      </main>
    </div>
  )
}
Drag options to blanks, or click blank then click option'
A(chat)
Bslot
D[chat]
Attempts:
3 left
💡 Hint
Common Mistakes
Using square brackets for parallel route folder names.
Not rendering the 'slot' prop correctly.