Last active
October 28, 2019 20:18
-
-
Save Jimmydalecleveland/7c316df0d21781ac88e95eeaa38fda94 to your computer and use it in GitHub Desktop.
Universal handleChange function for inputs
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
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