Skip to content

Instantly share code, notes, and snippets.

@jtomchak
Created April 3, 2018 18:26
Show Gist options
  • Save jtomchak/09215ce0f7e38370d445bc0d9992632c to your computer and use it in GitHub Desktop.
Save jtomchak/09215ce0f7e38370d445bc0d9992632c to your computer and use it in GitHub Desktop.
A form for death
import React from "react";
class DeathForm extends React.Component {
state = {
name: "",
how: ""
};
handleOnSubmit = event => {
event.preventDefault();
};
handleNameChange = event => {
console.log(event.target.value);
this.setState({
name: event.target.value
});
};
render() {
return (
<div>
<h3>React is my Death</h3>
<form onSubmit={e => this.handleOnSubmit(e)}>
<label>Name: </label>
<input value={this.state.name} onChange={this.handleNameChange} />
<br />
<label>How ?:</label>
<input value={this.state.how} />
<hr />
<button>Submit</button>
</form>
</div>
);
}
}
export default DeathForm;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment