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: src/routes/solid-start/guides/data-mutation.mdx
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ To handle [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/f
14
14
3. Ensure the `<form>` element uses the `post` method for submission.
15
15
4. Use the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData/FormData) object in the action to extract field data using the navite `FormData` methods.
16
16
17
-
```tsx tab title="TypeScript" {3-9} {13}
17
+
```tsx tab title="TypeScript" {4-10} {14}
18
18
// src/routes/index.tsx
19
19
import { action } from"@solidjs/router";
20
20
@@ -36,7 +36,7 @@ export default function Page() {
36
36
}
37
37
```
38
38
39
-
```jsx tab title="JavaScript" {3-9} {13}
39
+
```jsx tab title="JavaScript" {4-10} {14}
40
40
// src/routes/index.jsx
41
41
import { action } from"@solidjs/router";
42
42
@@ -62,7 +62,7 @@ export default function Page() {
62
62
63
63
To pass additional arguments to your action, use the `with` method:
64
64
65
-
```tsx tab title="TypeScript" {14}
65
+
```tsx tab title="TypeScript" {15}
66
66
// src/routes/index.tsx
67
67
import { action } from"@solidjs/router";
68
68
@@ -85,7 +85,7 @@ export default function Page() {
85
85
}
86
86
```
87
87
88
-
```jsx{14} tab title="JavaScript"
88
+
```jsx tab title="JavaScript" {15}
89
89
// src/routes/index.jsx
90
90
import { action } from"@solidjs/router";
91
91
@@ -115,7 +115,7 @@ To display a pending UI during action execution:
@@ -444,7 +444,7 @@ export default function Page() {
444
444
445
445
To safely interact with your database or ORM in an action, ensure it's server-only by adding [`"use server"`](/solid-start/reference/server/use-server) as the first line of your action:
446
446
447
-
```tsx tab title="TypeScript" {5}
447
+
```tsx tab title="TypeScript" {6}
448
448
// src/routes/index.tsx
449
449
import { action } from"@solidjs/router";
450
450
import { db } from"~/lib/db";
@@ -465,7 +465,7 @@ export default function Page() {
465
465
}
466
466
```
467
467
468
-
```jsx tab title="JavaScript" {5}
468
+
```jsx tab title="JavaScript" {6}
469
469
// src/routes/index.jsx
470
470
import { action } from"@solidjs/router";
471
471
import { db } from"~/lib/db";
@@ -493,7 +493,7 @@ To programmatically invoke an action:
493
493
1. Import [`useAction`](/solid-router/reference/data-apis/use-action) from `@solidjs/router`.
494
494
2. Call `useAction` with your action, and use the returned function to invoke the action.
0 commit comments