Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save brlafreniere/98f38a86369240b9d9d38962c20c5565 to your computer and use it in GitHub Desktop.
Save brlafreniere/98f38a86369240b9d9d38962c20c5565 to your computer and use it in GitHub Desktop.
handleFieldValueChange = (event) => {
console.log(event.target.name) // displays the name of the field I'm typing in
this.setState({[event.target.name]: event.target.value})
this.setState(prevState => {
console.log(event.target.name) // throws error: TypeError: Cannot read property 'name' of null
return {}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment