I am working on a project to create a Gmail clone. I have implemented the useForm library for data validation. However, when I input data into the form and try to print it to the console, nothing is being displayed.
const onSubmit = (data) => {
console.log(data);
};
<form onSubmit={handleSubmit(onSubmit)}>
<input name='to' placeholder='To' type='text' {...register('to', { required: true })} />
<input name='subject' placeholder='Subject' type='text' {...register('subject', { required: true })} />
<input name='message' placeholder='Type your message here...' type='text' className='sendMail_message' {...register('message', { required: true })} />
<div className='sendMail_options'>
<Button className='sendMail_send'>Send</Button>
</div>
</form>