Skip to content
Advertisement

How can validate and send react form data to fire base data base?

I try it but not working

JavaScript

Here what I pass in body?

JavaScript

There are many fields in my form but here I show some

JavaScript

That is code which I try but it not working anybody review it and give your valuable comments and suggestions Basically I want form validation using react hook form,its done but when I stuck in passing data to fire base data base when I use, useState then its override because react hook form already store it but how to pass it to data base with out useState?? Through react hook form

Advertisement

Answer

You should remove your onClick from the submit button and handle your form submission from the onSubmit event on the form. Send your form data to your firebase endpoint, from your onSubmit function like so.

JavaScript

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement