/** @jsx React.DOM */ var LongMessage = React.createClass({ getInitialState: function(props) { return { expanded: false, }; }, render: function() { var length = this.props.length ? this.props.length : 50; var text = this.props.children; if (text.length > length) { if (this.state.expanded) { return (
{text}
); } else { return (
{text.substring(0, length)}...
); } } else { return
{text}
; } }, });