Created
October 11, 2023 13:44
-
-
Save wildiney/83bcfca80c8e5fcda6fde1167a2fa68c to your computer and use it in GitHub Desktop.
A snippet to deal with the onChange in react forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const handleInputChange = (e:React.ChangeEvent<HTMLInputElement | HTMLSelectElement>)=>{ | |
const {name, value} = e.target | |
setState((prevState)=>{ | |
...prevState, | |
[name]:value | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment