@brzezinskibartosz
Hey yeah totally. So react-hook-form actually makes things a little easier and requires less code. You actually wont need to specify a handleChange function as react-hook-form will handle that for you & you also wont need the useState hook involved.
update your submitEmail function - remove the mailerState being sent and update the parameter name to anything else (named mine data in this example) & e.preventDefault as react-hook-form actually does that for you as well and will throw an error if you leave it.
not sure how to reset the values after submitting - youll probably want to check the docs
@brzezinskibartosz
Hey yeah totally. So
react-hook-form
actually makes things a little easier and requires less code. You actually wont need to specify a handleChange function asreact-hook-form
will handle that for you & you also wont need theuseState
hook involved.Here's a few things you'll need to try:
mailerState
being sent and update the parameter name to anything else (named minedata
in this example) &e.preventDefault
asreact-hook-form
actually does that for you as well and will throw an error if you leave it. not sure how to reset the values after submitting - youll probably want to check the docsHi Jared, actually i didn't have to change it. Most likely i had bug in handleStateChange function because i declared to many variables.
placeholder="Name"
name="name"
{...register("name", { required: true, minLength: 5 })}
/>
Below 'register' argument i added onChange and value. Everythinhg is working now.
Thanks!
Bartosz
Nice work, thats great to hear!