Browse Source

Fix all errors and warnings on homepage

Also onChange instead of onInput in two places!
main
Ben Alpert 12 years ago
parent
commit
8b5822bdf8
  1. 5
      _js/examples/timer.js
  2. 4
      _js/examples/todo.js
  3. 4
      _js/live_editor.js

5
_js/examples/timer.js

@ -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\

4
_js/examples/todo.js

@ -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\
@ -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\

4
_js/live_editor.js

@ -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() {
@ -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 (

Loading…
Cancel
Save