Created
July 6, 2016 02:37
-
-
Save anonymous/69651984694e37298b771cdeb1da838f to your computer and use it in GitHub Desktop.
// source http://jsbin.com/yidipu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://code.jquery.com/jquery.min.js"></script> | |
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script><script src="https://fb.me/react-with-addons-15.1.0.js"></script> | |
<script src="https://fb.me/react-dom-15.1.0.js"></script> | |
<div id="container"></div> | |
<script id="jsbin-javascript"> | |
var TweetBox = React.createClass({displayName: 'TweetBox', | |
getInitialState: function() { | |
return { | |
text: "" | |
}; | |
}, | |
handleChange: function(event) { | |
this.setState({ text: event.target.value }); | |
}, | |
render: function() { | |
return ( | |
React.createElement("div", {className: "well clearfix"}, | |
React.createElement("textarea", {className: "form-control", | |
onChange: this.handleChange} | |
), | |
React.createElement("br", null), | |
React.createElement("span", null, 140 - this.state.text.length), | |
React.createElement("button", {className: "btn btn-primary pull-right", | |
disabled: this.state.text.length === 0}, "Tweet") | |
) | |
); | |
} | |
}); | |
ReactDOM.render( | |
React.createElement(TweetBox, null), | |
document.getElementById("container") | |
); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var TweetBox = React.createClass({ | |
getInitialState: function() { | |
return { | |
text: "" | |
}; | |
}, | |
handleChange: function(event) { | |
this.setState({ text: event.target.value }); | |
}, | |
render: function() { | |
return ( | |
<div className="well clearfix"> | |
<textarea className="form-control" | |
onChange={this.handleChange}> | |
</textarea> | |
<br/> | |
<span>{140 - this.state.text.length}</span> | |
<button className="btn btn-primary pull-right" | |
disabled={this.state.text.length === 0}>Tweet</button> | |
</div> | |
); | |
} | |
}); | |
ReactDOM.render( | |
<TweetBox />, | |
document.getElementById("container") | |
);</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var TweetBox = React.createClass({displayName: 'TweetBox', | |
getInitialState: function() { | |
return { | |
text: "" | |
}; | |
}, | |
handleChange: function(event) { | |
this.setState({ text: event.target.value }); | |
}, | |
render: function() { | |
return ( | |
React.createElement("div", {className: "well clearfix"}, | |
React.createElement("textarea", {className: "form-control", | |
onChange: this.handleChange} | |
), | |
React.createElement("br", null), | |
React.createElement("span", null, 140 - this.state.text.length), | |
React.createElement("button", {className: "btn btn-primary pull-right", | |
disabled: this.state.text.length === 0}, "Tweet") | |
) | |
); | |
} | |
}); | |
ReactDOM.render( | |
React.createElement(TweetBox, null), | |
document.getElementById("container") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment