File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ This function will receive the form data if form validation is successful.
5656
5757``` typescript copy sandbox="https://codesandbox.io/s/react-hook-form-handlesubmit-ts-v7-lcrtu"
5858import React from " react"
59- import { useForm , SubmitHandler } from " react-hook-form"
59+ import { useForm , SubmitHandler , SubmitErrorHandler } from " react-hook-form"
6060
6161type FormValues = {
6262 firstName: string
@@ -67,6 +67,7 @@ type FormValues = {
6767export default function App() {
6868 const { register, handleSubmit } = useForm <FormValues >()
6969 const onSubmit: SubmitHandler <FormValues > = (data ) => console .log (data )
70+ const onError: SubmitErrorHandler <FormValues > = (errors ) => console .log (errors )
7071
7172 return (
7273 < form onSubmit = {handleSubmit(onSubmit )}>
You can’t perform that action at this time.
0 commit comments