Skip to content

Instantly share code, notes, and snippets.

@balanceiskey
Last active February 18, 2016 16:41
Show Gist options
  • Save balanceiskey/34f91098a980bef3788c to your computer and use it in GitHub Desktop.
Save balanceiskey/34f91098a980bef3788c to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
const React = require('react');
const ReactDOM = require('react-dom');
const SimpleTextarea = React.createClass({
getInitialState () {
return {
value: '',
};
},
_handleChange (ev) {
this.setState({value: ev.target.value});
},
render () {
return (
<textarea
onChange={this._handleChange}
placeholder="Some placeholder text"
value={this.state.value}
/>
);
}
});
ReactDOM.render(<SimpleTextarea />, document.body);
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"react": "0.14.7",
"react-dom": "0.14.7"
}
}
'use strict';
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
var React = require('react');
var ReactDOM = require('react-dom');
var SimpleTextarea = React.createClass({
displayName: 'SimpleTextarea',
getInitialState: function getInitialState() {
return {
value: ''
};
},
_handleChange: function _handleChange(ev) {
this.setState({ value: ev.target.value });
},
render: function render() {
return React.createElement('textarea', {
onChange: this._handleChange,
placeholder: 'Some placeholder text',
value: this.state.value
});
}
});
ReactDOM.render(React.createElement(SimpleTextarea, null), document.body);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment