var TODO_COMPONENT = ` var TodoList = React.createClass({ render: function() { var createItem = function(item) { return
  • {item.text}
  • ; }; return ; } }); var TodoApp = React.createClass({ getInitialState: function() { return {items: [], text: ''}; }, onChange: function(e) { this.setState({text: e.target.value}); }, handleSubmit: function(e) { e.preventDefault(); var nextItems = this.state.items.concat([{text: this.state.text, id: Date.now()}]); var nextText = ''; this.setState({items: nextItems, text: nextText}); }, render: function() { return (

    TODO

    ); } }); ReactDOM.render(, mountNode); `; ReactDOM.render( , document.getElementById('todoExample') );