Skip to content

Instantly share code, notes, and snippets.

@teejayvanslyke
Last active December 20, 2016 00:24
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 teejayvanslyke/e826a2d4f2e4b66bb5107e441a5cc27a to your computer and use it in GitHub Desktop.
Save teejayvanslyke/e826a2d4f2e4b66bb5107e441a5cc27a to your computer and use it in GitHub Desktop.
class MyForm extends React.Component {
constructor(props) {
super(props);
this.state = { message: "Hello, World" };
}
render() {
const input = React.createElement('input', {
type: 'text',
value: this.state.message,
onChange: ::this.handleChange
});
return React.createElement('div', {}, [
input,
this.state.message
]);
}
handleChange(event) {
this.setState({ message: event.target.value });
console.log(this.state);
}
}
ReactDOM.render(
React.createElement(MyForm),
document.getElementById('root'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment