Course contentsShow
← React
Lesson 1891 of 2,39643. RoutingFree lesson

Parallel Routes and Intercepting Routes

Advanced patterns for rendering multiple pages simultaneously and intercepting navigation for modals.

Parallel Routes and Intercepting Routes

What you'll learn: How to render multiple independent route segments simultaneously and intercept navigation to show modals without changing the URL.

What Are Parallel Routes?

In Next.js App Router, parallel routes let you render multiple pages in the same layout at once, each updating independently. Think of it like split-screen TV: you're watching two channels simultaneously, each with its own content that can change without affecting the other.

You define parallel routes using slot folders with the @ prefix: @analytics, @team, @feed. In your layout, you receive these as props and can position them wherever you want.

// app/dashboard/layout.tsx
export default function Layout({
  children,
  analytics,
  team
}: {
  children: React.ReactNode
  analytics: React.ReactNode
  team: React.ReactNode
}) {
  return (
    <div>
      <div>{children}</div>
      <div>{analytics}</div>
      <div>{team}</div>
    </div>
  )
}

Each slot can have its own loading states, error boundaries, and navigation—completely independently.

What Are Intercepting Routes?

Intercepting routes let you "hijack" navigation to show content in a modal while keeping the URL intact for sharing. When someone clicks a photo gallery thumbnail, you show the photo in a modal overlay. If they refresh or share that URL, they get the full photo page instead.

You use special folder naming: (.) for same level, (..) for one level up, (..)(..) for two levels up, or (...) for root.

// app/photos/(..)photo/[id]/page.tsx - Intercepts /photo/[id]
export default function PhotoModal({ params }: { params: { id: string } }) {
  return <Modal><img src={`/photo/${params.id}`} /></Modal>
}

These patterns work together: you can intercept navigation within a parallel route slot, creating sophisticated UI patterns like modal galleries or inline editing experiences.

Key Takeaway: Parallel routes render multiple independent segments simultaneously using @slot folders, while intercepting routes capture navigation with (.) syntax to show modals—both enabling advanced compositional patterns without client-side routing hacks.