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/explanation/race-conditions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@ React Router's handling of network concurrency is heavily inspired by the behavi
13
13
Consider clicking a link to a new document, and then clicking a different link before the new page has finished loading. The browser will:
14
14
15
15
1. cancel the first request
16
-
2. immediately processes the new navigation
16
+
2. immediately process the new navigation
17
17
18
-
This behavior includes form submissions. When a pending form submission is interrupted by a new one, the first is canceled and the new submission is immediately processed.
18
+
The same behavior applies to form submissions. When a pending form submission is interrupted by a new one, the first is canceled and the new submission is immediately processed.
Copy file name to clipboardExpand all lines: docs/how-to/fetchers.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,7 +80,7 @@ export default function Component() {
80
80
81
81
### 3. Submit the form
82
82
83
-
If you submit the form now, the fetcher call the action and revalidate the route data automatically.
83
+
If you submit the form now, the fetcher will call the action and revalidate the route data automatically.
84
84
85
85
### 4. Render pending state
86
86
@@ -299,4 +299,4 @@ Fetchers can be submitted programmatically with `fetcher.submit`:
299
299
</fetcher.Form>
300
300
```
301
301
302
-
Note the input event's form is passed as the first argument to `fetcher.submit`. The fetcher will use that form to submit the request, reading it's attributes and serializing the data from its elements.
302
+
Note the input event's form is passed as the first argument to `fetcher.submit`. The fetcher will use that form to submit the request, reading its attributes and serializing the data from its elements.
Copy file name to clipboardExpand all lines: docs/how-to/file-uploads.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,11 @@ title: File Uploads
6
6
7
7
Handle file uploads in your React Router applications. This guide uses some packages from the [Remix The Web][remix-the-web] project to make file uploads easier.
8
8
9
-
_Thank you to David Adams for [writing an original guide](https://programmingarehard.com/2024/09/06/remix-file-uploads-updated.html/) which this doc is based on. You can refer to it for even more examples._
9
+
_Thank you to David Adams for [writing an original guide](https://programmingarehard.com/2024/09/06/remix-file-uploads-updated.html/)on which this doc is based. You can refer to it for even more examples._
10
10
11
11
## Basic File Upload
12
12
13
-
👉 **Setup some routes**
13
+
### 1. Setup some routes
14
14
15
15
You can setup your routes however you like. This example uses the following structure:
16
16
@@ -28,7 +28,7 @@ export default [
28
28
] satisfiesRouteConfig;
29
29
```
30
30
31
-
👉 **Add the form data parser**
31
+
### 2. Add the form data parser
32
32
33
33
`form-data-parser` is a wrapper around `request.formData()` that provides streaming support for handling file uploads.
34
34
@@ -38,7 +38,7 @@ npm i @mjackson/form-data-parser
38
38
39
39
[See the `form-data-parser` docs for more information][form-data-parser]
40
40
41
-
👉 **Create a route with an upload action**
41
+
### 3. Create a route with an upload action
42
42
43
43
The `parseFormData` function takes an `uploadHandler` function as an argument. This function will be called for each file upload in the form.
44
44
@@ -83,7 +83,7 @@ export default function Component() {
83
83
84
84
## Local Storage Implementation
85
85
86
-
👉 **Add the storage package**
86
+
### 1. Add the storage package
87
87
88
88
`file-storage` is a key/value interface for storing [File objects][file] in JavaScript. Similar to how `localStorage` allows you to store key/value pairs of strings in the browser, file-storage allows you to store key/value pairs of files on the server.
89
89
@@ -93,7 +93,7 @@ npm i @mjackson/file-storage
93
93
94
94
[See the `file-storage` docs for more information][file-storage]
95
95
96
-
👉 **Create a storage configuration**
96
+
### 2. Create a storage configuration
97
97
98
98
Create a file that exports a `LocalFileStorage` instance to be used by different routes.
99
99
@@ -109,7 +109,7 @@ export function getStorageKey(userId: string) {
109
109
}
110
110
```
111
111
112
-
👉 **Implement the upload handler**
112
+
### 3. Implement the upload handler
113
113
114
114
Update the form's `action` to store files in the `fileStorage` instance.
115
115
@@ -177,7 +177,7 @@ export default function UserPage({
177
177
}
178
178
```
179
179
180
-
👉 **Add a route to serve the uploaded file**
180
+
### 4. Add a route to serve the uploaded file
181
181
182
182
Create a [resource route][resource-route] that streams the file as a response.
Copy file name to clipboardExpand all lines: docs/how-to/view-transitions.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ Enable smooth animations between page transitions in your React Router applicati
8
8
9
9
## Basic View Transition
10
10
11
-
👉 **Enable view transitions on navigation**
11
+
### 1. Enable view transitions on navigation
12
12
13
13
The simplest way to enable view transitions is by adding the `viewTransition` prop to your `Link`, `NavLink`, or `Form` components. This automatically wraps the navigation update in `document.startViewTransition()`.
14
14
@@ -26,7 +26,7 @@ For more information on using the View Transitions API, please refer to the ["Sm
26
26
27
27
Let's build an image gallery that demonstrates how to trigger and use view transitions. We'll create a list of images that expand into a detail view with smooth animations.
28
28
29
-
👉 **Create the image gallery route**
29
+
### 2. Create the image gallery route
30
30
31
31
```tsx filename=routes/image-gallery.tsx
32
32
import { NavLink } from"react-router";
@@ -62,7 +62,7 @@ export default function ImageGalleryRoute() {
62
62
}
63
63
```
64
64
65
-
👉 **Add transition styles**
65
+
### 3. Add transition styles
66
66
67
67
Define view transition names and animations for elements that should transition smoothly between routes.
68
68
@@ -98,7 +98,7 @@ Define view transition names and animations for elements that should transition
98
98
}
99
99
```
100
100
101
-
👉 **Create the image detail route**
101
+
### 4. Create the image detail route
102
102
103
103
The detail view needs to use the same view transition names to create a seamless animation.
104
104
@@ -122,7 +122,7 @@ export default function ImageDetailsRoute({
122
122
}
123
123
```
124
124
125
-
👉 **Add matching transition styles for the detail view**
125
+
### 5. Add matching transition styles for the detail view
126
126
127
127
```css filename=app.css
128
128
/* Match transition names from the list view */
@@ -144,7 +144,7 @@ export default function ImageDetailsRoute({
144
144
145
145
You can control view transitions more precisely using either render props or the `useViewTransitionState` hook.
146
146
147
-
👉 **Using render props**
147
+
### 1. Using render props
148
148
149
149
```tsx filename=routes/image-gallery.tsx
150
150
<NavLinkto={`/image/${idx}`}viewTransition>
@@ -172,7 +172,7 @@ You can control view transitions more precisely using either render props or the
172
172
</NavLink>
173
173
```
174
174
175
-
👉 **Using the `useViewTransitionState` hook**
175
+
### 2. Using the `useViewTransitionState` hook
176
176
177
177
```tsx filename=routes/image-gallery.tsx
178
178
function NavImage(props: { src:string; idx:number }) {
Copy file name to clipboardExpand all lines: docs/start/framework/rendering.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ There are three rendering strategies in React Router:
13
13
14
14
## Client Side Rendering
15
15
16
-
All routes are always client side rendered as the user navigates around the app. If you're looking to build a Single Page App, disable server rendering:
16
+
Routes are always client side rendered as the user navigates around the app. If you're looking to build a Single Page App, disable server rendering:
Server side rendering requires a deployment that supports it. Though it's a global setting, individual routes can still be statically pre-rendered, and/or use client data loading with `clientLoader` to avoid server rendering/fetching of their portion of the UI.
36
+
Server side rendering requires a deployment that supports it. Though it's a global setting, individual routes can still be statically pre-rendered. Routes can also use client data loading with `clientLoader` to avoid server rendering/fetching for their portion of the UI.
Copy file name to clipboardExpand all lines: docs/start/framework/routing.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ order: 2
7
7
8
8
## Configuring Routes
9
9
10
-
Routes are configured in `app/routes.ts`. Routes have a url pattern to match the URL and a file path to the route module to define its behavior.
10
+
Routes are configured in `app/routes.ts`. Each route has two required parts: a URL pattern to match the URL, and a file path to the route module that defines its behavior.
0 commit comments