()
| 15 | |
| 16 | |
| 17 | function Zodform(){ |
| 18 | |
| 19 | const {register, handleSubmit, formState: { errors }} = useForm({ |
| 20 | resolver: zodResolver(formSchema) |
| 21 | }); |
| 22 | |
| 23 | |
| 24 | function sumbitForm(data){ |
| 25 | console.log(data); |
| 26 | } |
| 27 | |
| 28 | console.log("Render"); |
| 29 | |
| 30 | return( |
| 31 | <> |
| 32 | <form onSubmit={handleSubmit(sumbitForm)}> |
| 33 | <div> |
| 34 | <label htmlFor="first">Name: </label> |
| 35 | <input id="first" {...register('name')} /> |
| 36 | {errors.name && <span>{errors.name.message}</span>} |
| 37 | </div> |
| 38 | <div> |
| 39 | <label htmlFor="fourth">Email: </label> |
| 40 | <input id="fourth" {...register('email')} /> |
| 41 | {errors.email && <span>{errors.email.message}</span>} |
| 42 | </div> |
| 43 | <div> |
| 44 | <label htmlFor="second">Age: </label> |
| 45 | <input id="second" {...register('age')} /> |
| 46 | {errors.age && <span>{errors.age.message}</span>} |
| 47 | </div> |
| 48 | <div> |
| 49 | <label htmlFor="third">Password: </label> |
| 50 | <input type="password" id="third" {...register('password' |
| 51 | )} /> |
| 52 | {errors.password && <span>{errors.password.message}</span>} |
| 53 | </div> |
| 54 | <div> |
| 55 | <label htmlFor="fifth">Confirm Password: </label> |
| 56 | <input type="password" id="fifth" {...register('confirm' |
| 57 | )} /> |
| 58 | {errors.confirm && <span>{errors.confirm.message}</span>} |
| 59 | </div> |
| 60 | <button>Submit</button> |
| 61 | </form> |
| 62 | |
| 63 | </> |
| 64 | ) |
| 65 | |
| 66 | } |
| 67 | |
| 68 | export default Zodform; |
nothing calls this directly
no test coverage detected