Skip to content

Commit b359383

Browse files
Update docs for pre-release (#12037)
* Update types in data-loading.md * Update links and remove future.md * Update most uses of defineRoute$ * Add docs warnings to all of the incomplete docs and sections
1 parent db57751 commit b359383

29 files changed

+353
-479
lines changed

Diff for: docs/deploying/cloudflare-spa.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Cloudflare SPA
33
---
4+
5+
# Deploying to Cloudflare with SPA
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/cloudflare.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Cloudflare
33
---
4+
5+
# Deploying to Cloudflare with SPA
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/custom-node.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Custom Node.js
33
---
4+
5+
# Deploying to a Custom Node.js Runtime
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/custom-spa.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Custom SPA
33
---
4+
5+
# Deploying to a Custom SPA
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/custom-wintercg.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Custom WinterCG
33
---
4+
5+
# Deploying to a Custom WinterCG
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/netlify.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Netlify
33
---
4+
5+
# Deploying to Netlify
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/vercel-spa.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Vercel SPA
33
---
4+
5+
# Deploying to Vercel SPA
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/deploying/vercel.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
---
22
title: Vercel
33
---
4+
5+
# Deploying to Vercel
6+
7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>

Diff for: docs/discussion/code-splitting.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
title: Automatic Code Splitting
33
new: true
44
---
5+
6+
# Automatic Code Splitting
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/discussion/race-conditions.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
title: Race Conditions
33
new: true
44
---
5+
6+
# Race Conditions
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/discussion/route-matching.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
title: Route Matching
33
new: true
44
---
5+
6+
# Route Matching
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/discussion/route-module-limitations.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ new: true
44
---
55

66
# Route Module Limitations
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/misc/form-validation.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
title: Form Validation
33
new: true
44
---
5+
6+
# Form Validation
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/misc/manual-deployment.md

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ title: Manual Deployment
44

55
# Manual Deployment
66

7+
<docs-warning>
8+
This document is a work in progress. There's not much to see here (yet).
9+
</docs-warning>
10+
11+
712
- static files
813
- running the server
914
- polyfilling globals

Diff for: docs/misc/react-server-components.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ new: true
55

66
# React Server Components
77

8-
They work!
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/misc/server-rendering.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ new: true
44
---
55

66
# Server Rendering
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/misc/streaming.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
title: Streaming
33
new: true
44
---
5+
6+
# Streaming
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/misc/view-transitions.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,9 @@
22
title: View Transitions
33
new: true
44
---
5+
6+
# View Transitions
7+
8+
<docs-warning>
9+
This document is a work in progress. There's not much to see here (yet).
10+
</docs-warning>

Diff for: docs/start/actions.md

+65-51
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ order: 6
55

66
# Actions
77

8+
<docs-warning>
9+
The types for route modules are still in development, this API may change.
10+
</docs-warning>
11+
812
Data mutations are done through Route actions. When the action completes, all loader data on the page is revalidated to keep your UI in sync with the data without writing any code to do it.
913

1014
Route actions defined with `action` are only called on the server while actions defined with `clientAction` are run in the browser.
@@ -15,31 +19,37 @@ Client actions only run in the browser and take priority over a server action wh
1519

1620
```tsx filename=app/project.tsx
1721
// route('/projects/:projectId', './project.tsx')
18-
import { defineRoute$, Form } from "react-router";
19-
20-
export default defineRoute$({
21-
clientAction({ request }) {
22-
let formData = await request.formData();
23-
let title = await formData.get("title");
24-
let project = await someApi.updateProject({ title });
25-
return project;
26-
},
27-
28-
Component({ data, actionData }) {
29-
return (
30-
<div>
31-
<h1>Project</h1>
32-
<Form method="post">
33-
<input type="text" name="title" />
34-
<button type="submit">Submit</button>
35-
</Form>
36-
{actionData ? (
37-
<p>{actionData.title} updated</p>
38-
) : null}
39-
</div>
40-
);
41-
},
42-
});
22+
import type {
23+
DefaultProps,
24+
ClientActionArgs,
25+
} from "./+types.project";
26+
import { Form } from "react-router";
27+
28+
export async function clientAction({
29+
request,
30+
}: ClientActionArgs) {
31+
let formData = await request.formData();
32+
let title = await formData.get("title");
33+
let project = await someApi.updateProject({ title });
34+
return project;
35+
}
36+
37+
export default function Project({
38+
clientActionData,
39+
}: DefaultProps) {
40+
return (
41+
<div>
42+
<h1>Project</h1>
43+
<Form method="post">
44+
<input type="text" name="title" />
45+
<button type="submit">Submit</button>
46+
</Form>
47+
{clientActionData ? (
48+
<p>{clientActionData.title} updated</p>
49+
) : null}
50+
</div>
51+
);
52+
}
4353
```
4454

4555
## Server Actions
@@ -48,31 +58,35 @@ Server actions only run on the server and are removed from client bundles.
4858

4959
```tsx filename=app/project.tsx
5060
// route('/projects/:projectId', './project.tsx')
51-
import { defineRoute$, Form } from "react-router";
52-
53-
export default defineRoute$({
54-
action({ request }) {
55-
let formData = await request.formData();
56-
let title = await formData.get("title");
57-
let project = await someApi.updateProject({ title });
58-
return project;
59-
},
60-
61-
Component({ data, actionData }) {
62-
return (
63-
<div>
64-
<h1>Project</h1>
65-
<Form method="post">
66-
<input type="text" name="title" />
67-
<button type="submit">Submit</button>
68-
</Form>
69-
{actionData ? (
70-
<p>{actionData.title} updated</p>
71-
) : null}
72-
</div>
73-
);
74-
},
75-
});
61+
import type {
62+
DefaultProps,
63+
ActionArgs,
64+
} from "./+types.project";
65+
import { Form } from "react-router";
66+
67+
export async function action({ request }: ActionArgs) {
68+
let formData = await request.formData();
69+
let title = await formData.get("title");
70+
let project = await someApi.updateProject({ title });
71+
return project;
72+
}
73+
74+
export default function Project({
75+
actionData,
76+
}: DefaultProps) {
77+
return (
78+
<div>
79+
<h1>Project</h1>
80+
<Form method="post">
81+
<input type="text" name="title" />
82+
<button type="submit">Submit</button>
83+
</Form>
84+
{actionData ? (
85+
<p>{actionData.title} updated</p>
86+
) : null}
87+
</div>
88+
);
89+
}
7690
```
7791

7892
## Calling Actions
@@ -153,4 +167,4 @@ fetcher.submit(
153167
);
154168
```
155169

156-
See the [Using Fetchers](../guides/fetchers) guide for more information.
170+
See the [Using Fetchers](../misc/fetchers) guide for more information.

0 commit comments

Comments
 (0)