0
0
NextJSframework~10 mins

Parallel routes concept in NextJS - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Parallel routes concept
User navigates to URL
Next.js Router checks routes
Identify parallel routes in layout
Render multiple route segments simultaneously
Combine segments into final page
Display combined UI to user
Next.js checks the URL, finds parallel routes, renders them at the same time, and combines them into one page.
Execution Sample
NextJS
export default function Page() {
  return (
    <div style={{ display: 'flex', gap: '1rem' }}>
      <Sidebar />
      <Content />
    </div>
  )
}
This code illustrates the final combined UI from parallel routes in Next.js, rendering Sidebar and Content side by side.
Execution Table
StepActionRoute SegmentRender ResultCombined UI
1User navigates to /dashboardN/AN/AN/A
2Router identifies parallel routessidebar and contentSidebar component renderedSidebar shown
3Router renders content routecontentContent component renderedSidebar and Content shown
4Combine sidebar and contentsidebar + contentBoth renderedSidebar and Content shown side by side
5Display final pagefull pageComplete UI renderedUser sees combined layout
💡 All parallel routes rendered and combined, page fully displayed.
Variable Tracker
VariableStartAfter Step 2After Step 3After Step 4Final
sidebarRenderedfalsetruetruetruetrue
contentRenderedfalsefalsetruetruetrue
combinedUIemptySidebar onlySidebar + ContentSidebar + ContentSidebar + Content
Key Moments - 2 Insights
Why do sidebar and content render separately but show together?
Because Next.js renders each parallel route segment independently (see steps 2 and 3), then combines them into one UI (step 4).
What happens if one parallel route fails to render?
The combined UI will miss that segment, so the page might look incomplete. Next.js tries to render all segments before showing the page (see step 4).
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, at which step does the content route render?
AStep 2
BStep 3
CStep 4
DStep 5
💡 Hint
Check the 'Route Segment' and 'Render Result' columns in step 3.
According to variable_tracker, when is sidebarRendered true?
AAfter Step 2
BAfter Step 1
CAfter Step 3
DAfter Step 5
💡 Hint
Look at the sidebarRendered row and its value after each step.
If the content route did not render, how would combinedUI look after Step 4?
AContent only
BEmpty
CSidebar only
DSidebar and Content
💡 Hint
Refer to combinedUI values in variable_tracker after Step 4.
Concept Snapshot
Parallel routes let Next.js render multiple parts of a page at once.
Each route segment renders independently.
Segments combine into one UI before display.
Use parallel routes to build layouts with sidebars, modals, or tabs.
This improves user experience by loading parts simultaneously.
Full Transcript
In Next.js, parallel routes allow rendering multiple route segments at the same time. When a user navigates to a URL, the router identifies which parts of the page come from parallel routes. It renders each segment independently, like a sidebar and main content. Then, Next.js combines these segments into one complete page and shows it to the user. This approach helps build complex layouts that load faster and feel smoother. The execution table shows each step: navigation, rendering sidebar, rendering content, combining, and final display. Variables track which parts have rendered and how the UI builds up. Common confusions include why segments render separately but show together, and what happens if one segment fails. Visual quizzes help check understanding of when each segment renders and how the combined UI forms.