baazjs
Version:
40 lines (33 loc) • 667 B
JavaScript
import React, { Component } from "react";
class Form extends Component {
constructor() {
super();
this.state = {
value: ""
};
this.handleChange = this.handleChange.bind(this);
}
handleChange(event) {
const { value } = event.target;
this.setState(() => {
return {
value
};
});
}
render() {
return (
<form>
<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
<input
type="text"
value={this.state.value}
onChange={this.handleChange}
/>
</form>
);
}
}
export default Form;