Skip to content

Instantly share code, notes, and snippets.

@wildiney
Created October 11, 2023 13:44
Show Gist options
  • Save wildiney/83bcfca80c8e5fcda6fde1167a2fa68c to your computer and use it in GitHub Desktop.
Save wildiney/83bcfca80c8e5fcda6fde1167a2fa68c to your computer and use it in GitHub Desktop.
A snippet to deal with the onChange in react forms
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