Skip to content

Instantly share code, notes, and snippets.

@luandevpro
Created March 27, 2018 05:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luandevpro/5473fd12c077f45919e7fabf234d59b9 to your computer and use it in GitHub Desktop.
Save luandevpro/5473fd12c077f45919e7fabf234d59b9 to your computer and use it in GitHub Desktop.
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