import { useForm } from 'react-hook-form'; function App() { const { register, handleSubmit, formState: { errors }, } = useForm(); return (
console.log(data))}> {errors.lastName &&

Last name is required.

} {errors.age &&

Please enter number for age.

}
); }