Created
July 13, 2017 12:31
-
-
Save dglowinski/8daa840aaddcb8a22ff65f264c1d9271 to your computer and use it in GitHub Desktop.
React - Thunk inputs
This file contains hidden or 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
inputOnChange = propName => ev => this.setState({ [propName] : ev.target.value }) | |
render () { | |
return ( | |
<form onSubmit={this.handleLogin} > | |
<input | |
type='input' | |
value={this.state.user} | |
placeholder='username' | |
className='header-login-input' | |
name='username' | |
onChange={this.inputOnChange('user')} /> | |
<input | |
type='input' | |
value={this.state.password} | |
placeholder='password' | |
className='header-login-input' | |
name='password' | |
onChange={this.inputOnChange('password')} /> | |
<input | |
type='submit' | |
value='Login Now' /> | |
</form> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment