@samitouri / QOS-React-2 / commits / e379f8ec03
Fork 0

The library for web and native user interfaces.

Fix all errors and warnings on homepage

Also onChange instead of onInput in two places!

Ben Alpert committed Jul 17, 2013 at 13:08 UTC e379f8ec03c9b350937ef78331c0e1a0f5364838
3 files changed +8 -5
docs/_js/examples/timer.js
+4 -1
@@ -11,7 +11,10 @@ var Timer = React.createClass({\n\
11 this.setState({secondsElapsed: this.state.secondsElapsed + 1});\n\
12 },\n\
13 componentDidMount: function() {\n\
14 - setInterval(this.tick, 1000);\n\
14 + this.interval = setInterval(this.tick, 1000);\n\
15 + },\n\
16 + componentWillUnmount: function() {\n\
17 + clearInterval(this.interval);\n\
18 },\n\
19 render: function() {\n\
20 return React.DOM.div({},\n\
docs/_js/examples/todo.js
+2 -2
@@ -16,7 +16,7 @@ var TodoApp = React.createClass({\n\
16 getInitialState: function() {\n\
17 return {items: [], text: ''};\n\
18 },\n\
19 - onKey: function(e) {\n\
19 + onChange: function(e) {\n\
20 this.setState({text: e.target.value});\n\
21 },\n\
22 handleSubmit: function(e) {\n\
@@ -31,7 +31,7 @@ var TodoApp = React.createClass({\n\
31 <h3>TODO</h3>\n\
32 <TodoList items={this.state.items} />\n\
33 <form onSubmit={this.handleSubmit}>\n\
34 - <input onKeyUp={this.onKey} defaultValue={this.state.text} />\n\
34 + <input onChange={this.onChange} value={this.state.text} />\n\
35 <button>{'Add #' + (this.state.items.length + 1)}</button>\n\
36 </form>\n\
37 </div>\n\
docs/_js/live_editor.js
+2 -2
@@ -24,7 +24,7 @@ var CodeMirrorEditor = React.createClass({
24 matchBrackets: true,
25 theme: 'solarized-light'
26 });
27 - this.editor.on('change', this.onChange.bind(this));
27 + this.editor.on('change', this.onChange);
28 this.onChange();
29 },
30 onChange: function() {
@@ -40,7 +40,7 @@ var CodeMirrorEditor = React.createClass({
40 if (IS_MOBILE) {
41 editor = <pre style={{overflow: 'scroll'}}>{this.props.codeText}</pre>;
42 } else {
43 - editor = <textarea ref="editor">{this.props.codeText}</textarea>;
43 + editor = <textarea ref="editor" defaultValue={this.props.codeText} />;
44 }
45
46 return (