Skip to content

Instantly share code, notes, and snippets.

@luandevpro luandevpro/cacaca
Created Mar 27, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.