Skip to content

Instantly share code, notes, and snippets.

@Jimmydalecleveland
Last active October 28, 2019 20:18
Show Gist options
  • Save Jimmydalecleveland/7c316df0d21781ac88e95eeaa38fda94 to your computer and use it in GitHub Desktop.
Save Jimmydalecleveland/7c316df0d21781ac88e95eeaa38fda94 to your computer and use it in GitHub Desktop.
Universal handleChange function for inputs
handleChange = event => {
const { name, type, value } = event.target;
const val = type === "number" ? parseFloat(value) : value;
this.setState({ [name]: value });
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment