Professional Documents
Culture Documents
On this page
Root Route
app/
├── routes/
└── root.tsx
1 import {
2 Links,
3 Meta,
4 Outlet,
5 Scripts,
6 ScrollRestoration,
7 } from "@remix-run/react";
8
9 export default function Root() {
10 return (
11 <html lang="en">
12 <head>
13 <Links />
14 <Meta />
15 </head>
16 <body>
17 <Outlet />
18 <ScrollRestoration />
19 <Scripts />
20 </body>
21 </html>
22 );
23 }
Basic Routes
app/
├── routes/
│ ├── _index.tsx
│ └── about.tsx
└── root.tsx
/ app/routes/_index.tsx
/about app/routes/about.tsx
Dot Delimiters
app/
├── routes/
│ ├── _index.tsx
│ ├── about.tsx
│ ├── concerts.trending.tsx
│ ├── concerts.salt-lake-city.tsx
│ └── concerts.san-diego.tsx
└── root.tsx
/concerts/trending app/routes/concerts.
/concerts/salt-lake-city app/routes/concerts.
/concerts/san-diego app/routes/concerts.
Dynamic Segments
app/
├── routes/
│ ├── _index.tsx
│ ├── about.tsx
│ ├── concerts.$city.tsx
│ └── concerts.trending.tsx
└── root.tsx
/concerts/trending app/routes/concerts.
/concerts/salt-lake-city app/routes/concerts.
/concerts/san-diego app/routes/concerts.
Remix will parse the value from the URL and pass
it to various APIs. We call these values "URL
Parameters". The most useful places to access
the URL params are in loaders and actions.
Nested Routes
app/
├── routes/
│ ├── _index.tsx
│ ├── about.tsx
│ ├── concerts._index.tsx
│ ├── concerts.$city.tsx
│ ├── concerts.trending.tsx
│ └── concerts.tsx
└── root.tsx
/ app/routes/_index.ts
/about app/routes/about.tsx
/concerts app/routes/concerts.
/concerts/trending app/routes/concerts.
/concerts/salt-lake-city app/routes/concerts.
1 <Root>
2 <Concerts>
3 <City />
4 </Concerts>
5 </Root>
app/
├── routes/
│ ├── _index.tsx
│ ├── about.tsx
│ ├── concerts.$city.tsx
│ ├── concerts.trending.tsx
│ ├── concerts.tsx
│ └── concerts_.mine.tsx
└── root.tsx
/ app/routes/_index.ts
/concerts/mine app/routes/concerts_
/concerts/trending app/routes/concerts.
/concerts/salt-lake-city app/routes/concerts.
app/
├── routes/
│ ├── _auth.login.tsx
│ ├── _auth.register.tsx
│ ├── _auth.tsx
│ ├── _index.tsx
│ ├── concerts.$city.tsx
│ └── concerts.tsx
└── root.tsx
/ app/routes/_index.ts
/login app/routes/_auth.log
/register app/routes/_auth.reg
/concerts/salt-lake-city app/routes/concerts.
Optional Segments
app/
├── routes/
│ ├── ($lang)._index.tsx
│ ├── ($lang).$productId.tsx
│ └── ($lang).categories.tsx
└── root.tsx
/ app/routes/($lang)._
/categories app/routes/($lang).c
/en/categories app/routes/($lang).c
/fr/categories app/routes/($lang).c
/american-flag-speedo app/routes/($lang)._
/en/american-flag-speedo app/routes/($lang).$
/fr/american-flag-speedo app/routes/($lang).$
Splat Routes
app/
├── routes/
│ ├── _index.tsx
│ ├── $.tsx
│ ├── about.tsx
│ └── files.$.tsx
└── root.tsx
URL Ma
/ ap
/beef/and/cheese ap
/files ap
/files/talks/remix-conf_old.pdf ap
/files/talks/remix-conf_final.pdf ap
/files/talks/remix-conf-FINAL-MAY_2022.pdf ap
app/routes/files.$.tsx
Filename URL
app/routes/sitemap[.]xml.tsx /sitemap.xm
app/routes/[sitemap.xml].tsx /sitemap.xm
app/routes/weird-url.[_index].tsx /weird-url/
app/routes/dolla-bills-[$].tsx /dolla-bill
app/routes/[[so-weird]].tsx /[so-weird]
app/
├── routes/
│ ├── _landing._index.tsx
│ ├── _landing.about.tsx
│ ├── _landing.tsx
│ ├── app._index.tsx
│ ├── app.projects.tsx
│ ├── app.tsx
│ └── app_.projects.$id.roadmap.tsx
└── root.tsx
app/
├── routes/
│ ├── _landing._index/
│ │ ├── route.tsx
│ │ └── scroll-experience.tsx
│ ├── _landing.about/
│ │ ├── employee-profile-card.tsx
│ │ ├── get-employee-data.server.tsx
│ │ ├── route.tsx
│ │ └── team-photo.jpg
│ ├── _landing/
│ │ ├── footer.tsx
│ │ ├── header.tsx
│ │ └── route.tsx
│ ├── app._index/
│ │ ├── route.tsx
│ │ └── stats.tsx
│ ├── app.projects/
│ │ ├── get-projects.server.tsx
│ │ ├── project-buttons.tsx
│ │ ├── project-card.tsx
│ │ └── route.tsx
│ ├── app/
│ │ ├── footer.tsx
│ │ ├── primary-nav.tsx
│ │ └── route.tsx
│ ├── app_.projects.$id.roadmap/
│ │ ├── chart.tsx
│ │ ├── route.tsx
│ │ └── update-timeline.server.tsx
│ └── contact-us.tsx
└── root.tsx
# as are these
app/routes/app._index.tsx
app/routes/app._index/route.tsx
Scaling
More Flexibility