File tree 2 files changed +4
-6
lines changed
example-app-router-playground/src/app/[locale]/actions
example-app-router-without-i18n-routing/src/app/login
2 files changed +4
-6
lines changed Original file line number Diff line number Diff line change 1
1
'use client' ;
2
2
3
- import { ReactNode } from 'react' ;
4
- import { useFormState } from 'react-dom' ;
3
+ import { ReactNode , useActionState } from 'react' ;
5
4
import { FormResult } from './ZodFormExample' ;
6
5
7
6
type Props = {
@@ -10,7 +9,7 @@ type Props = {
10
9
} ;
11
10
12
11
export default function ZodForm ( { action, children} : Props ) {
13
- const [ state , formAction ] = useFormState ( action , null ) ;
12
+ const [ state , formAction ] = useActionState ( action , null ) ;
14
13
const hasErrors = state && ! state . success ;
15
14
16
15
return (
Original file line number Diff line number Diff line change 1
1
'use client' ;
2
2
3
- import { ReactNode } from 'react' ;
4
- import { useFormState } from 'react-dom' ;
3
+ import { ReactNode , useActionState } from 'react' ;
5
4
import LoginFormErrors from './LoginFormErrors' ;
6
5
import { LoginFormResult } from './page' ;
7
6
@@ -16,7 +15,7 @@ export default function LoginForm({
16
15
header : ReactNode ;
17
16
submit : ReactNode ;
18
17
} ) {
19
- const [ state , formAction ] = useFormState ( action , null ) ;
18
+ const [ state , formAction ] = useActionState ( action , null ) ;
20
19
21
20
return (
22
21
< form
You can’t perform that action at this time.
0 commit comments