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/guides/accessibility.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
@@ -18,7 +18,7 @@ Remix also provides the [`<NavLink/>`][navlink] which behaves the same as `<Link
18
18
19
19
If you are rendering [`<Scripts>`][scripts] in your app, there are some important things to consider to make client-side routing more accessible for your users.
20
20
21
-
With a traditional multi-page website we don't have to think about route changes too much. Your app renders an anchor tag, and the browser handles the rest. If your users disable JavaScript, your Remix app should already work this way by default!
21
+
With a traditional multipage website we don't have to think about route changes too much. Your app renders an anchor tag, and the browser handles the rest. If your users disable JavaScript, your Remix app should already work this way by default!
22
22
23
23
When the client scripts in Remix are loaded, React Router takes control of routing and prevents the browser's default behavior. Remix doesn't make any assumptions about your UI as the route changes. There are some important features you'll want to consider as a result, including:
Copy file name to clipboardExpand all lines: docs/guides/api-development-strategy.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
@@ -57,12 +57,12 @@ export default defineConfig({
57
57
58
58
- Both the existing `v2` behavior and the new `v3_somethingDifferent` behavior coexist simultaneously.
59
59
- Applications can adopt changes incrementally, one step at a time, instead of having to adjust to a multitude of changes all at once in the next major release.
60
-
- If all the `v3_*` future flags are enabled, transitioning to `v3` should ideally not necessitate any changes to your codebase.
60
+
- If all the `v3_*` future flags are enabled, transitioning to `v3` should ideally not require any changes to your codebase.
61
61
- Some future flags that bring about breaking changes initially start as `unstable_*` flags. These might undergo modifications during minor releases. Once they become `v3_*` future flags, the corresponding API is set and won't change further.
62
62
63
63
## Summary
64
64
65
-
Our development strategy focuses on gradual feature adoption and seamless version upgrades for major releases. This empowers developers to selectively integrate new features, avoiding the need for extensive code adjustments during version transitions. By introducing features through `unstable_*` flags, we refine the API collaboratively with early adopters while ensuring stable releases benefit from enhancements. Through careful management of breaking changes using `v3_*` flags, we provide the flexibility to adopt changes incrementally, facilitating a smoother transition between major versions. While this increases the complexity for developing Remix the framework, this developer-centric approach greatly simplifies application development with Remix, ultimately leading to improved software quality and (hopefully!) developer satisfaction.
65
+
Our development strategy focuses on gradual feature adoption and seamless version upgrades for major releases. This empowers developers to selectively integrate new features, avoiding the need for extensive code adjustments during version transitions. By introducing features through `unstable_*` flags, we refine the API collaboratively with early adopters while ensuring stable releases benefit from enhancements. Through careful management of breaking changes using `v3_*` flags, we provide the flexibility to adopt changes incrementally, facilitating a smoother transition between major versions. While this increases the complexity of developing Remix the framework, this developer-centric approach greatly simplifies application development with Remix, ultimately leading to improved software quality and (hopefully!) developer satisfaction.
Copy file name to clipboardExpand all lines: docs/guides/api-routes.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
@@ -4,7 +4,7 @@ title: API Routes
4
4
5
5
# API Routes
6
6
7
-
You might be used to building React apps that don't run on the server, or least not very much of it does, so it's backed by a set of API routes. In Remix, most of your routes are both your UI and your API, so Remix in the browser knows how to talk to itself on the server.
7
+
You might be used to building React apps that don't run on the server, or at least not very much of it does, so it's backed by a set of API routes. In Remix, most of your routes are both your UI and your API, so Remix in the browser knows how to talk to itself on the server.
8
8
9
9
In general, you don't need the concept of "API Routes" at all. But we knew you'd come poking around with this term, so here we are!
10
10
@@ -92,7 +92,7 @@ function CitySearchCombobox() {
92
92
93
93
## Resource Routes
94
94
95
-
In other cases, you may need routes that are part of your application, but aren't part of your application's UI. Maybe you want a loader that renders a report as a PDF:
95
+
In other cases, you may need routes that are part of your application but aren't part of your application's UI. Maybe you want a loader that renders a report as a PDF:
Copy file name to clipboardExpand all lines: docs/guides/bff.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ toc: false
7
7
8
8
While Remix can serve as your fullstack application, it also fits perfectly into the "Backend for your Frontend" architecture.
9
9
10
-
The BFF strategy employs a web server with a job scoped to serving the frontend web app and connecting it to the services it needs: your database, mailer, job queues, existing backend APIs (REST, GraphQL), etc. Instead of your UI integrating directly from the browser to these services, it connects to the BFF and the BFF connects to your services.
10
+
The BFF strategy employs a web server with a job scoped to serving the frontend web app and connecting it to the services it needs: your database, mailer, job queues, existing backend APIs (REST, GraphQL), etc. Instead of your UI integrating directly from the browser to these services, it connects to the BFF, and the BFF connects to your services.
11
11
12
-
Mature apps already have a lot of backend application code in Ruby, Elixir, PHP, etc. and there's no reason to justify migrating it all to a server-side JavaScript runtime just to get the benefits of Remix. Instead, you can use your Remix app as a backend for your frontend.
12
+
Mature apps already have a lot of backend application code in Ruby, Elixir, PHP, etc., and there's no reason to justify migrating it all to a server-side JavaScript runtime just to get the benefits of Remix. Instead, you can use your Remix app as a backend for your frontend.
13
13
14
14
Because Remix polyfills the Web Fetch API, you can use `fetch` right from your loaders and actions to your backend.
15
15
@@ -21,7 +21,7 @@ import escapeHtml from "escape-html";
There are several benefits of this approach vs. fetching directly from the browser. The highlighted lines above show how you can:
45
45
46
-
1. Simplify thirdparty integrations and keep tokens and secrets out of client bundles.
46
+
1. Simplify third-party integrations and keep tokens and secrets out of client bundles.
47
47
2. Prune the data down to send less kB over the network, speeding up your app significantly.
48
48
3. Move a lot of code from browser bundles to the server, like `escapeHtml`, which speeds up your app. Additionally, moving code to the server usually makes your code easier to maintain since server-side code doesn't have to worry about UI states for async operations.
Copy file name to clipboardExpand all lines: docs/guides/breadcrumbs.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
@@ -4,11 +4,11 @@ title: Breadcrumbs Guide
4
4
5
5
# Breadcrumbs Guide
6
6
7
-
In Remix, you can easily build dynamic breadcrumbs based on your route hierarchy. This guide will take you through the process using the [`useMatches`][use-matches] and [`handle`][handle] features.
7
+
In Remix, you can build dynamic breadcrumbs based on your route hierarchy. This guide will take you through the process using the [`useMatches`][use-matches] and [`handle`][handle] features.
8
8
9
9
## Understanding the Basics
10
10
11
-
Remix provides access to all route matches and related data at the top of the React element tree. This enables components like [`<Meta />`][meta-component], [`<Links />`][links-component], and [`<Scripts />`][scripts-component] to obtain values from nested routes and render them at the top of the document.
11
+
Remix provides access to all route matches and related data at the top of the React element tree. This enables components like [`<Meta />`][meta-component], [`<Links />`][links-component], and [`<Scripts />`][scripts-component] to get values from nested routes and render them at the top of the document.
12
12
13
13
You can use a similar strategy using the `useMatches` and `handle` functions. While we're focusing on breadcrumbs, the principles demonstrated here are applicable to a range of scenarios.
Copy file name to clipboardExpand all lines: docs/guides/browser-support.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,21 @@ title: Browser Support
6
6
7
7
Remix only runs in browsers that support [ES Modules][esm-browsers].
8
8
9
-
Usually teams are concerned about IE11 support when asking this question. Note that [Microsoft itself has stopped supporting this browser][msie] for their web applications and it's probably time for you, too.
9
+
Usually teams are concerned about IE11 support when asking this question. Note that [Microsoft itself has stopped supporting this browser][msie] for their web applications, and it's probably time for you, too.
10
10
11
-
However, thanks to first-class support for [Progressive Enhancement][pe], Remix apps can support browsers as old as Netscape 1.0! This works because Remix is built on the foundations of the web: HTML, HTTP, and browser behavior. By following Remix conventions, your app can work at a baseline level for IE11, while still providing a highly-interactive SPA experience for modern browsers. It doesn't take much effort on your part to achieve this, either.
11
+
However, thanks to first-class support for [Progressive Enhancement][pe], Remix apps can support browsers as old as Netscape 1.0! This works because Remix is built on the foundations of the web: HTML, HTTP, and browser behavior. By following Remix conventions, your app can work at a baseline level for IE11, while still providing a highlyinteractive SPA experience for modern browsers. It doesn't take much effort on your part to achieve this, either.
12
12
13
13
Here's how it works. The Remix `<Scripts/>` component renders module script tags like this:
14
14
15
15
```html
16
16
<scripttype="module"src="..." />
17
17
```
18
18
19
-
Older browsers ignore it because they don't understand the `type`, so no JavaScript is loaded. Links, loaders, forms, and actions still work because they are built on the foundations of HTML, HTTP and browser behavior. Modern browsers will load the scripts, providing enhanced SPA behavior with faster transitions and the enhanced UX of your application code.
19
+
Older browsers ignore it because they don't understand the `type`, so no JavaScript is loaded. Links, loaders, forms, and actions still work because they are built on the foundations of HTML, HTTP, and browser behavior. Modern browsers will load the scripts, providing enhanced SPA behavior with faster transitions and the enhanced UX of your application code.
20
20
21
21
## Does Remix implement CSRF protection?
22
22
23
-
Remix cookies are configured to `SameSite=Lax` by default which is a platform built-in protection against CSRF, if you need to support old browsers (IE11 or older) that doesn't support `SameSite=Lax` you would have to implement CSRF protection yourself or use a library that implements it.
23
+
Remix cookies are configured to `SameSite=Lax` by default which is platform built-in protection against CSRF, if you need to support old browsers (IE11 or older) that doesn't support `SameSite=Lax` you would have to implement CSRF protection yourself or use a library that implements it.
Copy file name to clipboardExpand all lines: docs/guides/cache-control.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ hidden: true
7
7
8
8
## In Routes Modules
9
9
10
-
Each route can also define its http headers. This is mostly important for http caching. Remix doesn't rely on building your website into static files to be uploaded to a CDN for performance, instead we rely on cache headers. The end result of either approach is the same: a static document on a CDN. [Check out this video for more information on that][check-out-this-video-for-more-information-on-that].
10
+
Each route can also define its http headers. This is mostly important for http caching. Remix doesn't rely on building your website into static files to be uploaded to a CDN for performance, instead we rely on cache headers. The result of either approach is the same: a static document on a CDN. [Check out this video for more information on that][check-out-this-video-for-more-information-on-that].
11
11
12
-
Usually, the difficulty with cache headers is configuring them. In Remix we've made it easy. Just export a `headers` function from your route.
12
+
Usually, the difficulty with cache headers is configuring them. In Remix, we've made it easy. Just export a `headers` function from your route.
13
13
14
14
```tsx
15
15
exportfunction headers() {
@@ -27,9 +27,9 @@ export default function Gists() {
27
27
}
28
28
```
29
29
30
-
The max-age tells the user's browser to cache this for 300 seconds, or 5 minutes. That means if they click back or on a link to the same page again within 5 minutes, the browser won't even make a request for the page, it will use the cache.
30
+
The max-age tells the user's browser to cache this for 300 seconds or 5 minutes. That means if they click back or on a link to the same page again within 5 minutes, the browser won't even make a request for the page, it will use the cache.
31
31
32
-
The s-maxage tells the CDN to cache it for an hour. Here's what it looks like when the first person visits our website:
32
+
The `s-maxage` tells the CDN to cache it for an hour. Here's what it looks like when the first person visits our website:
33
33
34
34
1. Request comes in to the website, which is really the CDN
35
35
2. CDN doesn't have the document cached, so it makes a request to our server (the "origin server").
@@ -65,9 +65,9 @@ export function headers({
65
65
66
66
The `loaderHeaders` object is an instance of the [Web Fetch API Headers constructor][web-fetch-api-headers-constructor]
67
67
68
-
Now when the browser or a CDN wants to cache our page, it gets the headers from our data source, which is usually what you want. Note in our case we're actually just using headers GitHub sent in the response from our fetch!
68
+
Now when the browser or a CDN wants to cache our page, it gets the headers from our data source, which usually is what you want. Note in our case we're actually just using headers GitHub sent in the response from our fetch!
69
69
70
-
The second reason this matters is that Remix calls your loaders via `fetch` in the browser on client-side transitions. By returning good cache headers here, when the user clicks back/forward or visits the same page multiple times, the browser won't actually make another request for the data but will use a cached version instead. This greatly speeds up a website's performance, even for pages that you can't cache on a CDN. A lot of React apps rely on a JavaScript cache, but browser caches already work great!
70
+
The second reason this matters is that Remix calls your loaders via `fetch` in the browser on client-side transitions. By returning good cache headers here, when the user clicks back/forward or visits the same page multiple times, the browser won't make another request for the data but will use a cached version instead. This greatly speeds up a website's performance, even for pages that you can't cache on a CDN. A lot of React apps rely on a JavaScript cache, but browser caches already work great!
Copy file name to clipboardExpand all lines: docs/guides/client-data.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ title: Client Data
6
6
7
7
Remix introduced support for "Client Data" ([RFC][rfc]) in [`v2.4.0`][2.4.0] which allows you to opt-into running route loaders/actions in the browser via [`clientLoader`][clientloader]/[`clientAction`][clientaction] exports from your route.
8
8
9
-
These new exports are a bit of a sharp knife and are not recommended as your _primary_ data loading/submission mechanisms - but instead give you a lever to pull on for some of the following advanced use cases:
9
+
These new exports are a bit of a sharp knife and are not recommended as your _primary_ data loading/submission mechanisms — but instead give you a lever to pull on for some of the following advanced use cases:
10
10
11
11
-**Skip the Hop:** Query a data API directly from the browser, using loaders simply for SSR
12
12
-**Fullstack State:** Augment server data with client data for your full set of loader data
13
13
-**One or the Other:** Sometimes you use server loaders, sometimes you use client loaders, but not both on one route
14
14
-**Client Cache:** Cache server loader data in the client and avoid some server calls
15
-
-**Migration:** Ease your migration from React Router -> Remix SPA -> Remix SSR (once Remix supports [SPA Mode][rfc-spa])
15
+
-**Migration:** Ease your migration from React Router → Remix SPA → Remix SSR (once Remix supports [SPA Mode][rfc-spa])
16
16
17
-
Please use these new exports with caution! If you're not careful - it's easy to get your UI out of sync. Remix out of the box tries _very_ hard to ensure that this doesn't happen - but once you take control over your own client-side cache, and potentially prevent Remix from performing its normal server `fetch` calls - then Remix can no longer guarantee your UI remains in sync.
17
+
Please use these new exports with caution! If you're not careful — it's straightforward to get your UI out of sync. Remix out of the box tries _very_ hard to ensure that this doesn't happen - but once you take control over your own client-side cache, and potentially prevent Remix from performing its normal server `fetch` calls - then Remix can no longer guarantee your UI remains in sync.
18
18
19
19
## Skip the Hop
20
20
@@ -88,7 +88,7 @@ export function HydrateFallback() {
88
88
}
89
89
90
90
exportdefaultfunction Component() {
91
-
// This will always be the combined set of server + client data
91
+
// This will always be the combined set of server and client data
92
92
const data =useLoaderData();
93
93
return <>...</>;
94
94
}
@@ -227,7 +227,7 @@ We expect to write up a separate guide for migrations once [SPA Mode][rfc-spa] l
227
227
3. Incrementally move to file-based route definitions via the use of a Vite plugin (not yet provided)
228
228
4. Migrate your React Router SPA to Remix SPA Mode where all current file-based `loader` function act as `clientLoader`
229
229
5. Opt out of Remix SPA Mode (and into Remix SSR mode) and find/replace your `loader` functions to `clientLoader`
230
-
- You're now running an SSR app but all your data loading is still happening in the client via `clientLoader`
230
+
- You're now running an SSR app, but all your data loading is still happening in the client via `clientLoader`
231
231
6. Incrementally start moving `clientLoader -> loader` to start moving data loading to the server
0 commit comments