Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docs/_js/examples/timer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ var Timer = React.createClass({\n\
this.setState({secondsElapsed: this.state.secondsElapsed + 1});\n\
},\n\
componentDidMount: function() {\n\
setInterval(this.tick, 1000);\n\
this.interval = setInterval(this.tick, 1000);\n\
},\n\
componentWillUnmount: function() {\n\
clearInterval(this.interval);\n\
},\n\
render: function() {\n\
return React.DOM.div({},\n\
Expand Down
4 changes: 2 additions & 2 deletions docs/_js/examples/todo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var TodoApp = React.createClass({\n\
getInitialState: function() {\n\
return {items: [], text: ''};\n\
},\n\
onKey: function(e) {\n\
onChange: function(e) {\n\
this.setState({text: e.target.value});\n\
},\n\
handleSubmit: function(e) {\n\
Expand All @@ -31,7 +31,7 @@ var TodoApp = React.createClass({\n\
<h3>TODO</h3>\n\
<TodoList items={this.state.items} />\n\
<form onSubmit={this.handleSubmit}>\n\
<input onKeyUp={this.onKey} defaultValue={this.state.text} />\n\
<input onChange={this.onChange} value={this.state.text} />\n\
<button>{'Add #' + (this.state.items.length + 1)}</button>\n\
</form>\n\
</div>\n\
Expand Down
4 changes: 2 additions & 2 deletions docs/_js/live_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var CodeMirrorEditor = React.createClass({
matchBrackets: true,
theme: 'solarized-light'
});
this.editor.on('change', this.onChange.bind(this));
this.editor.on('change', this.onChange);
this.onChange();
},
onChange: function() {
Expand All @@ -40,7 +40,7 @@ var CodeMirrorEditor = React.createClass({
if (IS_MOBILE) {
editor = <pre style={{overflow: 'scroll'}}>{this.props.codeText}</pre>;
} else {
editor = <textarea ref="editor">{this.props.codeText}</textarea>;
editor = <textarea ref="editor" defaultValue={this.props.codeText} />;
}

return (
Expand Down