File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
packages/react-router-dom Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ async function action({ request }) {
23
23
``` js
24
24
// Opt-into JSON encoding with `encType: "application/json"`
25
25
function Component () {
26
+ let navigation = useNavigation ();
26
27
let submit = useSubmit ();
27
28
submit ({ key: " value" }, { encType: " application/json" });
28
29
// navigation.formEncType => "application/json"
@@ -31,13 +32,14 @@ function Component() {
31
32
32
33
async function action ({ request }) {
33
34
// request.headers.get("Content-Type") => "application/json"
34
- // await request.json => { key: "value" }
35
+ // await request.json() => { key: "value" }
35
36
}
36
37
```
37
38
38
39
``` js
39
- // Opt-into JSON encoding with `encType: "application/json "`
40
+ // Opt-into text encoding with `encType: "text/plain "`
40
41
function Component () {
42
+ let navigation = useNavigation ();
41
43
let submit = useSubmit ();
42
44
submit (" Text submission" , { encType: " text/plain" });
43
45
// navigation.formEncType => "text/plain"
Original file line number Diff line number Diff line change 41
41
42
42
async function action ({ request }) {
43
43
// request.headers.get("Content-Type") => "application/json"
44
- // await request.json => { key: "value" }
44
+ // await request.json() => { key: "value" }
45
45
}
46
46
```
47
47
48
48
``` js
49
- // Opt-into JSON encoding with `encType: "application/json "`
49
+ // Opt-into text encoding with `encType: "text/plain "`
50
50
function Component () {
51
51
let submit = useSubmit ();
52
52
submit (" Text submission" , { encType: " text/plain" });
You can’t perform that action at this time.
0 commit comments