File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change 1+ ## Inertia + React
2+
13- Use `router.visit()` or `<Link >` for navigation instead of traditional links.
2- <code-snippet lang =" react" name =" Inertia client navigation" >
4+
5+ <code-snippet lang =" react" name =" Inertia Client Navigation" >
36 import { Link } from '@inertiajs /react'
47
58 <Link href =" /" >Home</Link >
69</code-snippet >
710
8- - For form handling, use `router.post` and related methods, do not use regular forms.
9- <code-snippet lang =" react" name =" Form example" >
11+ - For form handling, use `router.post` and related methods. Do not use regular forms.
12+
13+ <code-snippet lang =" react" name =" Inertia React Form Example" >
1014import { useState } from 'react'
1115import { router } from '@inertiajs /react'
1216
2024 function handleChange(e) {
2125 const key = e.target.id;
2226 const value = e.target.value
27+
2328 setValues(values => ({
2429 ...values,
2530 [key]: value,
@@ -28,6 +33,7 @@ function handleChange(e) {
2833
2934 function handleSubmit(e) {
3035 e.preventDefault()
36+
3137 router.post('/users', values)
3238 }
3339
Original file line number Diff line number Diff line change 1+ ## Inertia + Vue
2+
13- Vue components must have a single root element.
24- Use `router.visit()` or `<Link >` for navigation instead of traditional links.
3- <code-snippet lang =" vue" name =" Inertia client navigation" >
5+
6+ <code-snippet lang =" vue" name =" Inertia Client Navigation" >
47 import { Link } from '@inertiajs /vue3'
58
69 <Link href =" /" >Home</Link >
710</code-snippet >
811
9- - For form handling, use `router.post` and related methods, do not use regular forms.
12+ - For form handling, use `router.post` and related methods. Do not use regular forms.
13+
1014@verbatim
11- <code-snippet lang =" vue" name =" Form example " >
15+ <code-snippet lang =" vue" name =" Inertia Vue Form Example " >
1216 <script setup >
1317 import { reactive } from ' vue'
1418 import { router } from ' @inertiajs /vue3'
You can’t perform that action at this time.
0 commit comments