Skip to content

Commit 8224f0d

Browse files
docs(discussions): Adds headers to server-client discussion to illustrate according to topics
1 parent ed12d8d commit 8224f0d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

docs/discussion/04-server-vs-client.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ import { useLoaderData } from "@remix-run/react";
2121

2222
import { getUser, updateUser } from "../user";
2323

24+
export function headers() {
25+
return { "Cache-Control": "max-age=300, s-maxage=3600" }
26+
}
27+
2428
export function loader({ request }) {
2529
const user = await getUser(request);
2630
return {
@@ -58,7 +62,7 @@ export function action({ request }) {
5862
}
5963
```
6064

61-
The server build will contain the entire module in the final bundle. However, the client build will remove the loader and action, along with the dependencies, resulting in this:
65+
The server build will contain the entire module in the final bundle. However, the client build will remove the headers, loader, and action, along with the dependencies, resulting in this:
6266

6367
```tsx filename=routes/settings.tsx
6468
import { useLoaderData } from "@remix-run/react";
@@ -87,6 +91,6 @@ You can force code out of either the client or the server with the `*.client.tsx
8791

8892
While rare, sometimes server code makes it to client bundles because of how the compiler determines the dependencies of a route module, or because you accidentally try to use it in code that needs to ship to the client. You can force it out by adding `*.server.tsx` on the end of the file name.
8993

90-
For example, we could name a module `app/user.server.ts` instead of `app/user.ts` to ensure that the code in that module is never bundled into the client--even if you try to use it in the component.
94+
For example, we could name a module `app/user.server.ts` instead of `app/user.ts` to ensure that the code in that module is never bundled into the client - even if you try to use it in the component.
9195

92-
Additionally, you may depend on client libraries that are unsafe to even bundle on the server--maybe it tries to access `window` by simply being imported. You can likewise remove these modules from the server build by appending `*.client.tsx` to the file name.
96+
Additionally, you may depend on client libraries that are unsafe to even bundle on the server - maybe it tries to access `window` by simply being imported. You can likewise remove these modules from the server build by appending `*.client.tsx` to the file name.

docs/discussion/05-react-router.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ This also means that the 90% of Remix is really just React Router: a very old, v
1212

1313
## Importing Components and Hooks
1414

15-
Remix Re-exports all of the components and hooks from React Router DOM, so you don't need to install React Router yourself.
15+
Remix re-exports all of the components and hooks from React Router DOM, so you don't need to install React Router yourself.
1616

1717
🚫 Don't do this:
1818

0 commit comments

Comments
 (0)