File tree 2 files changed +5
-10
lines changed
packages/example-app/src/app
2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change 1
1
"use client" ;
2
2
3
3
import { useState } from "react" ;
4
- import type { loginUser } from "./login-action" ;
4
+ import { loginUser } from "./login-action" ;
5
5
6
- type Props = {
7
- login : typeof loginUser ; // infer types with `typeof`
8
- } ;
9
-
10
- const LoginForm = ( { login } : Props ) => {
6
+ const LoginForm = ( ) => {
11
7
const [ result , setResult ] = useState (
12
8
"fill in form and click on the log in button"
13
9
) ;
@@ -22,7 +18,7 @@ const LoginForm = ({ login }: Props) => {
22
18
username : string ;
23
19
password : string ;
24
20
} ;
25
- const res = await login ( input ) ; // this is the typesafe action called from client
21
+ const res = await loginUser ( input ) ; // this is the typesafe action called from client
26
22
setResult ( JSON . stringify ( res , null , 1 ) ) ;
27
23
} } >
28
24
< input
Original file line number Diff line number Diff line change 1
1
import Link from "next/link" ;
2
- import { loginUser } from "./login-action" ;
3
2
import LoginForm from "./login-form" ;
4
3
5
4
export const metadata = {
@@ -13,9 +12,9 @@ export default function Home() {
13
12
< Link href = "/hook" > Go to /hook</ Link >
14
13
< Link href = "/optimistic-hook" > Go to /optimistic-hook</ Link >
15
14
< Link href = "/form" > Go to /form</ Link >
15
+ < Link href = "/nested-schema" > Go to /nested-schema</ Link >
16
16
< h1 > Action without auth</ h1 >
17
- { /* Pass the typesafe mutation to Client Component */ }
18
- < LoginForm login = { loginUser } />
17
+ < LoginForm />
19
18
</ >
20
19
) ;
21
20
}
You can’t perform that action at this time.
0 commit comments