You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/how-to/file-route-conventions.md
+7-10Lines changed: 7 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -117,7 +117,7 @@ Usually your URLs aren't static but data-driven. Dynamic segments allow you to m
117
117
The value will be parsed from the URL and passed to various APIs. We call these values "URL Parameters". The most useful places to access the URL params are in [loaders] and [actions].
118
118
119
119
```tsx
120
-
exportasyncfunctionserverLoader({ params }) {
120
+
exportasyncfunctionloader({ params }) {
121
121
returnfakeDb.getAllConcertsForCity(params.city);
122
122
}
123
123
```
@@ -127,7 +127,7 @@ You'll note the property name on the `params` object maps directly to the name o
127
127
Routes can have multiple dynamic segments, like `concerts.$city.$date`, both are accessed on the params object by name:
128
128
129
129
```tsx
130
-
exportasyncfunctionserverLoader({ params }) {
130
+
exportasyncfunctionloader({ params }) {
131
131
returnfake.db.getConcerts({
132
132
date: params.date,
133
133
city: params.city,
@@ -285,7 +285,7 @@ While [dynamic segments][dynamic_segments] match a single path segment (the stuf
285
285
Similar to dynamic route parameters, you can access the value of the matched path on the splat route's `params` with the `"*"` key.
286
286
287
287
```tsx filename=app/routes/files.$.tsx
288
-
exportasyncfunctionserverLoader({ params }) {
288
+
exportasyncfunctionloader({ params }) {
289
289
const filePath =params["*"];
290
290
returnfake.getFileInfo(filePath);
291
291
}
@@ -301,15 +301,12 @@ To create a route that will match any requests that don't match other defined ro
To have this route serve as a 404 page, be sure to modify the response code with a [`loader`](https://reactrouter.com/start/framework/data-loading#server-data-loading) function:
304
+
By default the matched route will return a 200 response, so be sure to modify your catchall route to return a 404 instead:
0 commit comments