Created
March 27, 2018 05:59
-
-
Save luandevpro/5473fd12c077f45919e7fabf234d59b9 to your computer and use it in GitHub Desktop.
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
import React, { Component } from 'react'; | |
class Input extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
fullName: '', | |
status: false | |
} | |
} | |
handleFullNameChange = (e) => { | |
var target = e.target; | |
var fullname = target.fullname; | |
var value = target.value; | |
this.setState({ | |
[fullname] : value | |
}) | |
} | |
handleSubmit = (e) => { | |
e.preventDefault(); | |
console.log(this.state) | |
} | |
render() { | |
return ( | |
<div> | |
<form onSubmit={this.handleSubmit}> | |
<label>Full Name</label> | |
<input | |
type="text" | |
value={this.state.fullName} | |
onChange={this.handleFullNameChange} | |
name="fullName" /> | |
<select name="status" required="required" value={this.state.status} | |
onChange={this.onChange} > | |
<option value={true}>Kích Hoạt</option> | |
<option value={false}>Ẩn</option> | |
</select> | |
<input type="submit" value="Submit" /> | |
</form> | |
</div> | |
); | |
} | |
} | |
export default Input; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment