Created
August 11, 2018 19:50
-
-
Save JerryLeeCS/9a812f4810af3a1f18caa58fc7260a6e to your computer and use it in GitHub Desktop.
ReactJS binding state to to input value
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
onChange(e) { | |
this.setState({ [e.target.name]: e.target.value }); | |
} | |
<input | |
type="password" | |
placeholder="Password" | |
name="password" | |
value={this.state.password} | |
onChange={this.onChange} | |
/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment