# Parallel Routes (@slot)

> Render multiple pages simultaneously in one layout.

Subject: Next.js | Lesson 18 of 65 | 6 min read
Interactive lesson: https://codewithanimation.in/nextjs/parallel-routes
Previous: [Route Groups (...)](https://codewithanimation.in/nextjs/route-groups.md) | Next: [Intercepting Routes (..)](https://codewithanimation.in/nextjs/intercepting-routes.md)

## The @slot syntax

Parallel Routes allow you to display multiple, completely independent pages within the exact same layout.

You define them using 'slots', which are folders prefixed with an `@` symbol (e.g., `@team` or `@analytics`). These folders do not affect the URL structure.

## Independent lifecycles

Why not just import a `<Team />` and `<Analytics />` component directly into the page?

Because components are tied to the page's lifecycle. With Parallel Routes, each slot acts as its own mini-application. If `@analytics` crashes, only the analytics section shows an error boundary. If `@team` takes 5 seconds to load data, it shows a localized loading spinner while the rest of the dashboard remains fully interactive.

## Passing slots as props

When you create `app/@team/page.tsx` and `app/@analytics/page.tsx`, Next.js automatically passes them as props to the `layout.tsx` file in the same directory.

Your layout receives them alongside `children`: `export default function Layout({ children, team, analytics })`.

## Common mistake: The children revelation

A massive 'aha' moment for Next.js developers is realizing that the `children` prop is not magic.

`children` is literally just an implicit parallel route slot. Under the hood, Next.js treats your main `app/page.tsx` as if it were inside a hidden `app/@children/page.tsx` folder.

## Tip: Modals made easy

Parallel routes are the perfect tool for building modals. You create an `@modal` slot.

When the user navigates to `/login`, you can intercept the route and render the login page inside the `@modal` slot, overlaying it on top of the current page's `children`.

## Try it: Independent Lifecycles

Click 'Load Dashboard'. Watch how the `@team` and `@analytics` slots load entirely independently. If one is slow, it doesn't block the other.

The animation is on the lesson page and is not part of this text version: https://codewithanimation.in/nextjs/parallel-routes

## Check yourself

### Question 1

If you create a folder named @sidebar next to layout.tsx, how do you render it inside the layout?

- A. Import it like a standard component: import Sidebar from './@sidebar'
- B. Access it via the props object: function Layout({ sidebar })
- C. Use the Next.js <Slot name='sidebar'> component
- D. It renders automatically below the children prop

Correct answer: B

Next.js automatically passes parallel route slots as props to the nearest `layout.tsx` based on the folder name (without the `@`).

- Why not A: Next.js handles the import automatically via the routing system.
- Why not C: Next.js doesn't use a <Slot> component; it uses React props.
- Why not D: You must explicitly place the prop in the JSX where you want it.

### Question 2

What happens if @team loads instantly, but @analytics takes 4 seconds to fetch data?

- A. The entire layout waits 4 seconds before rendering anything
- B. @team throws a timeout error
- C. @team renders instantly. @analytics shows a fallback (if loading.tsx exists) for 4 seconds.
- D. Next.js cancels the @analytics request to prioritize @team

Correct answer: C

Parallel Routes have completely independent lifecycles. They can stream in at different times, utilizing their own `loading.tsx` and `error.tsx` boundaries without blocking sibling slots.

- Why not A: That defeats the purpose of parallel routes.
- Why not B: The slots are independent.
- Why not D: It processes both.

## Remember this

- Define a parallel route by prefixing a folder with `@`.
- Slots are passed as props to the nearest `layout.tsx`.
- Each slot has independent loading, error, and navigation states.
- The `children` prop is just an implicit `@children` slot.
