g00glen00b / dimitri.codes

Static generator for dimitri.codes using Gatsby
https://dimitri.codes
Other
20 stars 8 forks source link

https://dimitri.codes/form-validation-react-hooks #125

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Form validation using React hooks | Dimitri's tutorials

In this tutorial I'll show you how you can make a generic React hook to handle form validation.

https://dimitr.im/form-validation-react-hooks

VictorJozwicki commented 2 years ago

You should use previousState in your setState instead of using the current values

setValues(prevState => {...prevState, [event.target.name]: event.target.value})

0xelisa commented 2 years ago

Thanks a ton! Super helpful tutorial :)