Skip to content

Commit 5db56e3

Browse files
davidbieliktimdorr
andauthored
docs(start/framework/routing): add 404 route instructions (#13764)
Co-authored-by: Tim Dorr <timdorr@users.noreply.github.com>
1 parent 986fef8 commit 5db56e3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/start/framework/routing.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,18 @@ You can destructure the `*`, you just have to assign it a new name. A common nam
301301
const { "*": splat } = params;
302302
```
303303

304+
You can also use a splat to catch requests that don't match any route:
305+
306+
```ts filename=app/routes.ts lines=[6]
307+
import { type RouteConfig, route, index } from "@react-router/dev/routes";
308+
309+
export default [
310+
index("./home.tsx"),
311+
route("about", "./about.tsx"),
312+
route("*", "./404.tsx")
313+
] satisfies RouteConfig;
314+
```
315+
304316
## Component Routes
305317

306318
You can also use components that match the URL to elements anywhere in the component tree:

0 commit comments

Comments
 (0)