File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed
src/content/docs/useformstate Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -155,15 +155,18 @@ export default function App() {
155155```
156156
157157``` javascript copy sandbox="https://codesandbox.io/s/react-hook-form-v7-errormessage-multiple-error-messages-lnvkt"
158- import { useForm } from " react-hook-form" ;
159- import { ErrorMessage } from ' @hookform/error-message' ;
160-
158+ import { useForm } from " react-hook-form"
159+ import { ErrorMessage } from " @hookform/error-message"
161160
162161export default function App () {
163- const { register , formState: { errors }, handleSubmit } = useForm ({
164- criteriaMode: " all"
165- });
166- const onSubmit = data => console .log (data);
162+ const {
163+ register ,
164+ formState: { errors },
165+ handleSubmit ,
166+ } = useForm ({
167+ criteriaMode: " all" ,
168+ })
169+ const onSubmit = (data ) => console .log (data)
167170
168171 return (
169172 < form onSubmit= {handleSubmit (onSubmit)}>
@@ -172,12 +175,12 @@ export default function App() {
172175 required: " This is required." ,
173176 pattern: {
174177 value: / d+ / ,
175- message: " This input is number only."
178+ message: " This input is number only." ,
176179 },
177180 maxLength: {
178181 value: 10 ,
179- message: " This input exceed maxLength."
180- }
182+ message: " This input exceed maxLength." ,
183+ },
181184 })}
182185 / >
183186 < ErrorMessage
@@ -191,12 +194,10 @@ export default function App() {
191194 }
192195 / >
193196
194-
195197 < input type= " submit" / >
196198 < / form>
197- );
199+ )
198200}
199-
200201```
201202
202203</TabGroup >
You can’t perform that action at this time.
0 commit comments